package com.playball.lottery.frm.buyhall;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.playball.lottery.R;
import com.playball.lottery.ApplicationData;
import com.playball.lottery.JddMainActivity;
import com.playball.lottery.base.BaseActivity;
import com.playball.lottery.customview.BallDTO;
import com.playball.lottery.customview.MyDialog;
import com.playball.lottery.frm.help.CaiPiaoHelp;
import com.playball.lottery.frm.kjinfo.KjinfoListByType;
import com.playball.lottery.frm.yhzx.BetRecordActivity;
import com.playball.lottery.frm.yhzx.LoginActivity;
import com.playball.lottery.frm.yhzx.ZhRecordActivity;
import com.playball.lottery.nt.GetRequestParams;
import com.playball.lottery.util.ConvertJsonToList;
import com.playball.lottery.util.DefConstants;
import com.playball.lottery.util.DynArrayInt;
import com.playball.lottery.util.Kuai3Util;
import com.playball.lottery.util.SensorListener;
import com.playball.lottery.util.SoundManage;
import com.playball.lottery.util.SysApplication;


/**
 * 重庆时时彩购彩界面
 * 
 * @author Administrator
 * 
 */
public class CQSSCActivity extends BaseActivity implements Serializable, DefConstants {
	/** 上下文内容 */
	private Context context = null;
	private static final long serialVersionUID = 1L;
	public Button imButton01, imButton02, imButton03, imButton04, imButton05, imButton06, imButton07, imButton08,
			imButton09, imButton10;
	public Button imButtonb_01, imButtonb_02, imButtonb_03, imButtonb_04, imButtonb_05, imButtonb_06, imButtonb_07,
			imButtonb_08, imButtonb_09, imButtonb_10, imButtonc_01, imButtonc_02, imButtonc_03, imButtonc_04,
			imButtonc_05, imButtonc_06, imButtonc_07, imButtonc_08, imButtonc_09, imButtonc_10;
	public Button imButtond_01, imButtond_02, imButtond_03, imButtond_04, imButtond_05, imButtond_06, imButtond_07,
			imButtond_08, imButtond_09, imButtond_10, imButtone_01, imButtone_02, imButtone_03, imButtone_04,
			imButtone_05, imButtone_06, imButtone_07, imButtone_08, imButtone_09, imButtone_10;
	public Button imButtond_dxds1_01, imButtond_dxds1_02, imButtond_dxds1_03, imButtond_dxds1_04, imButtond_dxds2_01,
			imButtond_dxds2_02, imButtond_dxds2_03, imButtond_dxds2_04;
	private LinearLayout buy_11x5_first_num, buy_11x5_2nd_num, buy_11x5_3rd_num, buy_11x5_first_text_layout;
	// 星 百位 个位 大小单双 十位 个位
	private LinearLayout buy_11x5_4th_num, buy_11x5_5th_num, buy_cqssc_first_dxds, buy_cqssc_second_dxds;
	private Button buy_11x5_random;// 机选红球
	private Button buy_11x5_clear;// 清空选择
	private Button buy_11x5_submit;// 确认选择
	/** 大小单双等玩法中间的分割线 */
	private View buy_cqssc_dxds_line, buy_cqssc_wanqian_line, buy_cqssc_qianbai_line, buy_cqssc_baishi_line,
			buy_cqssc_shige_line;
	private TextView currentIssue;// 当前期次
	private TextView endTimeText;// 截至时间
	private TextView countText;// 倍数
	private TextView moneyText;
	private int lotID;
	private long endTime; // 剩余时间
	private int playTypeId = 2803;
	private int count;
	private int allMoney;
	private String issueID; // 当前期次编号
	private String issueName;
	private PopupWindow m_popupWindow;
	boolean flag = false;
	/** 万位 */
	private DynArrayInt ball_wanwei_dintInt;
	/** 千位 */
	private DynArrayInt ball_qianwei_dintInt;
	/** 百位 */
	private DynArrayInt ball_baiwei_dintInt;
	/** 十位 */
	private DynArrayInt ball_shiwei_dintInt;
	/** 个位 */
	private DynArrayInt ball_gewei_dintInt;
	/** 大小单双 十位 */
	private DynArrayInt ball_dxdsShi_dintInt;
	/** 大小单双 个位 */
	private DynArrayInt ball_dxdsGe_dintInt;
	Handler handler = new Handler();
	/** 玩法 */
	private String strPlayType = "三星直选";
	/** 个位 左侧竖写名字 */
	private LinearLayout buy_cqssc_5th_geweiName;
	private SensorListener sensor;
	/** .若中奖：奖金0元，盈利0元 */
	private TextView tvJiangJin;
	/** 菜单弹出框 */
	private PopupWindow menu_popupWindow;
	/** 菜单弹出框 */
	private View menutypeview;
	/** 摇一摇机选一注视图 */
	private LinearLayout buy_ssq_llfoot0;
	/** 注数金额 */
	private RelativeLayout buy_ssq_rlfoot1;
	/** 点击此处可以弹出下拉10期开奖 */
	private LinearLayout buy_ssqxh_llxiala;
	/** 下拉10期开奖详情 */
	private LinearLayout buy_ssqxh_ll10kjdetail;
	/** 下拉10期开奖详情 */
	private List<Map<String, Object>> kjData;
	/** 判断是否从推送通知过来 */
	private Boolean ifPush;
	/** 奖金 */
	private int prizeIntellChase;

	/** 判断是否从选号列表过来 */
	private Boolean ifbacklist;
	
	private LinearLayout buy_ssqxh_Button03,buy_ssqxh_Button04;//清空，机选

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.context = this;
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.buy_cqssc);
		SysApplication.getInstance().addActivity(this);
		TitleBar();

		kaijiangAsyncLoader task = new kaijiangAsyncLoader();
		task.execute(LOT_ID_CQSSC + "", "301");

		Intent intent = getIntent();
		lotID = LOT_ID_CQSSC;
		issueID = intent.getStringExtra("IssueID");
		issueName = intent.getStringExtra("IssueName");
		endTime = intent.getLongExtra("EndTime", 0);
		playTypeId = intent.getIntExtra("PlayTypeID", 2803);
		ifbacklist = intent.getBooleanExtra("ifbacklist", false);
		strPlayType = intent.getStringExtra("strPlayType");
		ifPush = intent.getBooleanExtra("ifPush", false);
		if (strPlayType == null) {
			strPlayType = "三星直选";
		}

		initView();

		currentIssue.setText(issueName);

		handler.postDelayed(runnable, 1000);

		AsyncLoader task1 = new AsyncLoader();
		String[] parms = new String[2];
		parms[0] = "200";
		JSONObject jsob = new JSONObject();
		try {
			// 设置请求所需参数
			jsob.put("LottID", LOT_ID_CQSSC);
		} catch (JSONException ex) {
			// TODO Auto-generated catch block
			Log.e("error", ex.toString());
		}
		parms[1] = jsob.toString();
		task1.execute(parms);

		// 下拉10期开奖
		buy_ssqxh_llxiala.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				doKaiJiang();
			}
		});

		buy_ssqxh_ll10kjdetail.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (buy_ssqxh_ll10kjdetail.getVisibility() == View.VISIBLE) {
					buy_ssqxh_ll10kjdetail.setVisibility(View.GONE);
				}
			}
		});

		// 清空选择
		buy_11x5_clear.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (ball_gewei_dintInt.getSize() != 0 || ball_dxdsGe_dintInt.getSize() != 0) {
					initBall();
					allMoney = 0;
					count = 0;
					moneyText.setText("0");
					countText.setText("0");
					tvJiangJin.setText(context.getString(R.string.buy_show_jiangjin));
					buy_ssq_llfoot0.setVisibility(View.VISIBLE);
					buy_ssq_rlfoot1.setVisibility(View.GONE);
				} else {
					// Log.v("22", "号码未选择");
					Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_1, Toast.LENGTH_SHORT).show();
					initBall();
				}
			}
		});

		// 晃动手机机选号码
		sensor = new SensorListener(this);
		sensor.setOnSensorListener(new SensorListener.OnSensorListener() {
			@Override
			public void onShake() {
				// TODO Auto-generated method stub
				SoundManage.OnVibator(CQSSCActivity.this, 500);
				initRandomBall();
				// SoundManage.OnPlaySound(SsqxhActivity.this, "audio.mp3");
			}
		});

		// 机选
		buy_11x5_random.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				initRandomBall();
			}
		});

		// 确认选择，跳转至CQSSCListbActivity.class
		buy_11x5_submit.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				
				goXhlbSubmit();
			}
		});
		
		if(!ifbacklist){
			initRandomBall();
		}
	}

	/**
	 * 开奖栏点击 事件
	 */
	protected void doKaiJiang() {
		if (kjData != null && buy_ssqxh_ll10kjdetail.getVisibility() == View.GONE) {
			buy_ssqxh_ll10kjdetail.setVisibility(View.VISIBLE);
			TextView buy_ssq_10qikj_tvqici1 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici1);
			TextView buy_ssq_10qikj_tvqici2 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici2);
			TextView buy_ssq_10qikj_tvqici3 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici3);
			TextView buy_ssq_10qikj_tvqici4 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici4);
			TextView buy_ssq_10qikj_tvqici5 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici5);
			TextView buy_ssq_10qikj_tvqici6 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici6);
			TextView buy_ssq_10qikj_tvqici7 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici7);
			TextView buy_ssq_10qikj_tvqici8 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici8);
			TextView buy_ssq_10qikj_tvqici9 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici9);
			TextView buy_ssq_10qikj_tvqici10 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvqici10);

			TextView buy_ssq_10qikj_tvred1 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred1);
			TextView buy_ssq_10qikj_tvred2 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred2);
			TextView buy_ssq_10qikj_tvred3 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred3);
			TextView buy_ssq_10qikj_tvred4 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred4);
			TextView buy_ssq_10qikj_tvred5 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred5);
			TextView buy_ssq_10qikj_tvred6 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred6);
			TextView buy_ssq_10qikj_tvred7 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred7);
			TextView buy_ssq_10qikj_tvred8 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred8);
			TextView buy_ssq_10qikj_tvred9 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred9);
			TextView buy_ssq_10qikj_tvred10 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvred10);

			TextView buy_ssq_10qikj_tvblue1 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue1);
			TextView buy_ssq_10qikj_tvblue2 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue2);
			TextView buy_ssq_10qikj_tvblue3 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue3);
			TextView buy_ssq_10qikj_tvblue4 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue4);
			TextView buy_ssq_10qikj_tvblue5 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue5);
			TextView buy_ssq_10qikj_tvblue6 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue6);
			TextView buy_ssq_10qikj_tvblue7 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue7);
			TextView buy_ssq_10qikj_tvblue8 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue8);
			TextView buy_ssq_10qikj_tvblue9 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue9);
			TextView buy_ssq_10qikj_tvblue10 = (TextView) findViewById(R.id.buy_ssq_10qikj_tvblue10);

			if (kjData != null && kjData.size() > 0) {
				buy_ssq_10qikj_tvqici1.setText(kjData.get(0).get("Issue").toString());
				buy_ssq_10qikj_tvred1.setText(kjData.get(0).get("Ball").toString());
				if (kjData.size() > 1) {
					buy_ssq_10qikj_tvqici2.setText(kjData.get(1).get("Issue").toString());
					buy_ssq_10qikj_tvred2.setText(kjData.get(1).get("Ball").toString());
				}
				if (kjData.size() > 2) {
					buy_ssq_10qikj_tvqici3.setText(kjData.get(2).get("Issue").toString());
					buy_ssq_10qikj_tvred3.setText(kjData.get(2).get("Ball").toString());
				}
				if (kjData.size() > 3) {
					buy_ssq_10qikj_tvqici4.setText(kjData.get(3).get("Issue").toString());
					buy_ssq_10qikj_tvred4.setText(kjData.get(3).get("Ball").toString());
				}
				if (kjData.size() > 4) {
					buy_ssq_10qikj_tvqici5.setText(kjData.get(4).get("Issue").toString());
					buy_ssq_10qikj_tvred5.setText(kjData.get(4).get("Ball").toString());
				}
				if (kjData.size() > 5) {
					buy_ssq_10qikj_tvqici6.setText(kjData.get(5).get("Issue").toString());
					buy_ssq_10qikj_tvred6.setText(kjData.get(5).get("Ball").toString());
				}
				if (kjData.size() > 6) {
					buy_ssq_10qikj_tvqici7.setText(kjData.get(6).get("Issue").toString());
					buy_ssq_10qikj_tvred7.setText(kjData.get(6).get("Ball").toString());
				}
				if (kjData.size() > 7) {
					buy_ssq_10qikj_tvqici8.setText(kjData.get(7).get("Issue").toString());
					buy_ssq_10qikj_tvred8.setText(kjData.get(7).get("Ball").toString());
				}
				if (kjData.size() > 8) {
					buy_ssq_10qikj_tvqici9.setText(kjData.get(8).get("Issue").toString());
					buy_ssq_10qikj_tvred9.setText(kjData.get(8).get("Ball").toString());
				}
				if (kjData.size() > 9) {
					buy_ssq_10qikj_tvqici10.setText(kjData.get(9).get("Issue").toString());
					buy_ssq_10qikj_tvred10.setText(kjData.get(9).get("Ball").toString());
				}

				if (kjData.get(0).get("BlueBall") != null && !"".equals(kjData.get(0).get("BlueBall").toString())) {
					buy_ssq_10qikj_tvblue1.setText(kjData.get(0).get("BlueBall").toString());
					if (kjData.size() > 1) {
						buy_ssq_10qikj_tvblue2.setText(kjData.get(1).get("BlueBall").toString());
					}
					if (kjData.size() > 2) {
						buy_ssq_10qikj_tvblue3.setText(kjData.get(2).get("BlueBall").toString());
					}
					if (kjData.size() > 3) {
						buy_ssq_10qikj_tvblue4.setText(kjData.get(3).get("BlueBall").toString());
					}
					if (kjData.size() > 4) {
						buy_ssq_10qikj_tvblue5.setText(kjData.get(4).get("BlueBall").toString());
					}
					if (kjData.size() > 5) {
						buy_ssq_10qikj_tvblue6.setText(kjData.get(5).get("BlueBall").toString());
					}
					if (kjData.size() > 6) {
						buy_ssq_10qikj_tvblue7.setText(kjData.get(6).get("BlueBall").toString());
					}
					if (kjData.size() > 7) {
						buy_ssq_10qikj_tvblue8.setText(kjData.get(7).get("BlueBall").toString());
					}
					if (kjData.size() > 8) {
						buy_ssq_10qikj_tvblue9.setText(kjData.get(8).get("BlueBall").toString());
					}
					if (kjData.size() > 9) {
						buy_ssq_10qikj_tvblue10.setText(kjData.get(9).get("BlueBall").toString());
					}
				} else {
					TextView buy_10qikj_tvfh1 = (TextView) findViewById(R.id.buy_10qikj_tvfh1);
					TextView buy_10qikj_tvfh2 = (TextView) findViewById(R.id.buy_10qikj_tvfh2);
					TextView buy_10qikj_tvfh3 = (TextView) findViewById(R.id.buy_10qikj_tvfh3);
					TextView buy_10qikj_tvfh4 = (TextView) findViewById(R.id.buy_10qikj_tvfh4);
					TextView buy_10qikj_tvfh5 = (TextView) findViewById(R.id.buy_10qikj_tvfh5);
					TextView buy_10qikj_tvfh6 = (TextView) findViewById(R.id.buy_10qikj_tvfh6);
					TextView buy_10qikj_tvfh7 = (TextView) findViewById(R.id.buy_10qikj_tvfh7);
					TextView buy_10qikj_tvfh8 = (TextView) findViewById(R.id.buy_10qikj_tvfh8);
					TextView buy_10qikj_tvfh9 = (TextView) findViewById(R.id.buy_10qikj_tvfh9);
					TextView buy_10qikj_tvfh10 = (TextView) findViewById(R.id.buy_10qikj_tvfh10);
					buy_10qikj_tvfh1.setVisibility(View.GONE);
					buy_10qikj_tvfh2.setVisibility(View.GONE);
					buy_10qikj_tvfh3.setVisibility(View.GONE);
					buy_10qikj_tvfh4.setVisibility(View.GONE);
					buy_10qikj_tvfh5.setVisibility(View.GONE);
					buy_10qikj_tvfh6.setVisibility(View.GONE);
					buy_10qikj_tvfh7.setVisibility(View.GONE);
					buy_10qikj_tvfh8.setVisibility(View.GONE);
					buy_10qikj_tvfh9.setVisibility(View.GONE);
					buy_10qikj_tvfh10.setVisibility(View.GONE);

					buy_ssq_10qikj_tvblue1.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue1.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue2.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue3.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue4.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue5.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue6.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue7.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue8.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue9.setVisibility(View.GONE);
					buy_ssq_10qikj_tvblue10.setVisibility(View.GONE);
				}
			}
		} else {
			if(buy_ssqxh_ll10kjdetail.getVisibility()==View.VISIBLE){
				buy_ssqxh_ll10kjdetail.setVisibility(View.GONE);
			}else {
				Toast.makeText(this,"无往期开奖信息",Toast.LENGTH_SHORT).show();
			}
		}
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		sensor.stop();
		
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		sensor.start();
		
	}

	public void sendIntent(BallDTO elvdto, String ball) {
		setplayTypeId();
		elvdto.setElv_ball(ball + "-" + allMoney);

		// 新选的号码，追加在ApplicationBall全局变量list_ssqdto里
		ApplicationData.getInstance().getList_cqsscdto().add(elvdto);
		ApplicationData.getInstance().setAll_cqsscmoney(ApplicationData.getInstance().getAll_cqsscmoney() + allMoney);
		ApplicationData.getInstance().setPlay_cqsscId(playTypeId);
		ApplicationData.getInstance().setPlay_cqssctype(strPlayType);
		Intent intent = new Intent();
		intent.putExtra("list_elvdto", ApplicationData.getInstance().getList_cqsscdto());
		intent.putExtra("PlayTypeID", playTypeId);
		// intent.putExtra("PlayType", playType.getSelectedItem().toString());
		intent.putExtra("AllMoney", ApplicationData.getInstance().getAll_cqsscmoney());
		intent.putExtra("LotID", lotID);
		intent.putExtra("Count", count);
		intent.putExtra("IssueID", issueID);
		intent.putExtra("IssueName", issueName);
		intent.putExtra("strPlayType", strPlayType);
		intent.putExtra("prizeIntellChase", prizeIntellChase);
		intent.setClass(CQSSCActivity.this, CQSSCListActivity.class);
		startActivityForResult(intent, REQ_CODE_BUYMAIN);// (intent);
		finish();
	}

	// 倒计时
	Runnable runnable = new Runnable() {
		@Override
		public void run() {
			getCountDown(endTime--);
			handler.postDelayed(this, 1000);
		}
	};

	private void getCountDown(long end) {
		if (end > 0) {
			String res = "";
			long temp = 0;
			long d = end / 86400;
			temp = end - (d * 86400);
			if (d > 0) {
				res += d + "天";
			}

			long h = temp / 3600;
			if (h > 0) {
				res += h + "时";
			}
			temp = temp - (h * 3600);

			long m = temp / 60;
			if (m > 0) {
				res += m + "分";
			}
			temp = temp - (m * 60);

			long s = temp;
			res += s + "秒";
			endTimeText.setText(res);
		} else {
			endTimeText.setText("----------");
			// AsyncLoader task = new AsyncLoader();
			// task.execute("206");
			AsyncLoader task = new AsyncLoader();
			String[] parms = new String[2];
			parms[0] = "200";
			JSONObject jsob = new JSONObject();
			try {
				// 设置请求所需参数
				jsob.put("LottID", LOT_ID_CQSSC);
			} catch (JSONException ex) {
				// TODO Auto-generated catch block
				Log.e("error", ex.toString());
			}
			parms[1] = jsob.toString();
			task.execute(parms);
		}
	}

	private List<Map<String, Object>> mData;
	private Map<String, Object> cData;

	class AsyncLoader extends AsyncTask<String, Integer, String> {// 继承AsyncTask
		int id;

		// 1.准备运行
		protected void onPreExecute() {
		}

		// 2.正在后台运行
		@Override
		protected String doInBackground(String... params) {
			// 处理后台执行的任务，在后台线程执行
			String strResult;
			// String param = new String();
			// 设置请求action
			String action = params[0];
			// 获取请求返回值
			strResult = GetRequestParams.getRequestResult(params[1], action, getApplicationContext());
			return strResult;
		}

		// 3.进度更新
		protected void onProgressUpdate(Integer... progress) {
		}

		// 4.完成后台任务
		protected void onPostExecute(String result) {
			if (result == null) {
				Toast.makeText(CQSSCActivity.this, getString(R.string.problem_01), Toast.LENGTH_LONG).show();
				return;
			}
			if (result != null) {
				mData = getData(result);
				try {
					JSONTokener jsonParser = new JSONTokener(result);
					JSONObject js = (JSONObject) jsonParser.nextValue();
					// 接下来的就是JSON对象的操作了
					if (Integer.parseInt(js.getString("Code")) == 0) {
						for (int i = 0; i < mData.size(); i++) {
							id = Integer.parseInt(mData.get(i).get("LotID").toString());
							cData = mData.get(i);
							switch (id) {
							case LOT_ID_CQSSC:
								issueID = cData.get("IssueID").toString();
								issueName = cData.get("IssueName").toString();
								endTime = setEndTime(cData);
								currentIssue.setText(issueName);
							}
						}
					} else {
						Toast.makeText(CQSSCActivity.this, js.getString("Data"), Toast.LENGTH_SHORT).show();
					}
				} catch (JSONException ex) {
					// 异常处理代码
					Log.e("error", ex.toString());
				}
			}
		}

		// 5.完成后操作
		protected void onCancelled() {
		}
	}

	/**
	 * 
	 * 获取开奖数据
	 * 
	 */
	public class kaijiangAsyncLoader extends AsyncTask<String, Integer, String> {// 继承AsyncTask

		// 1.准备运行
		protected void onPreExecute() {
			// showdialog.showDialog(KjinfoListByType.this);
		}

		// 2.正在后台运行
		@Override
		protected String doInBackground(String... params) {
			String strResult;
			try {
				// 处理后台执行的任务，在后台线程执行
				JSONObject param = new JSONObject();
				param.put("LottID", params[0]);
				// 设置请求action
				String action = params[1];
				// 获取请求返回值
				strResult = GetRequestParams.getRequestResult(param.toString(), action, getApplicationContext());
				return strResult;
			} catch (Exception e) {
				// TODO: handle exception
				Log.e("error", e.toString());
				return null;
			}
		}

		// 3.进度更新
		protected void onProgressUpdate(Integer... progress) {
		}

		// 4.完成后台任务
		protected void onPostExecute(String result) {
			if (result != null) {
				try {
					JSONTokener jsonParser = new JSONTokener(result);
					JSONObject js = (JSONObject) jsonParser.nextValue();
					// 接下来的就是JSON对象的操作了
					if (Integer.parseInt(js.getString("Code")) == 0) {
						if (!"".equals(js.getString("Data"))&& !"[]".equals(js.getString("Data"))) {
							kjData = getData(result);
							for (int i = 0; i < kjData.size(); i++) {
								String issue = kjData.get(i).get("Issue").toString();
								issue += "期";// = "期\t开奖号码"
								kjData.get(i).put("Issue", issue);
								String winNumber = kjData.get(i).get("WinNumber").toString();
								String[] nums = winNumber.split("\\+");
								// kjData.get(i).put("Ball", nums[0]);
								kjData.get(i).put("Ball", nums[0].replaceAll(",", " "));
								kjData.get(i).put("BlueBall", nums.length > 1 ? nums[1].trim() : "");
							}
							Log.v("cqsscxh", "kjData= " + kjData.toString());
							// KjInfoListAdapter adapter = new
							// KjInfoListAdapter(Fc3dxhActivity.this, mData);
							// buy_11x5_lv_kaijiang.setAdapter(adapter);
						} else {
							Toast.makeText(CQSSCActivity.this, R.string.temporarily_no_data, Toast.LENGTH_SHORT).show();
						}
						// showdialog.closeDialog();
					} else {
						Toast.makeText(CQSSCActivity.this, js.getString("Data"), Toast.LENGTH_SHORT).show();
					}
				} catch (JSONException ex) {
					// 异常处理代码
					Log.e("error", ex.toString());
				} finally {
					// showdialog.closeDialog();
				}
			} else {
			}
		}

		// 5.完成后操作
		protected void onCancelled() {
		}

	}

	private List<Map<String, Object>> getData(String strResult) {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		try {
			JSONTokener jsonParser = new JSONTokener(strResult);
			JSONObject js = (JSONObject) jsonParser.nextValue();
			list = ConvertJsonToList.getList(js.getString("Data"));
		} catch (JSONException ex) {
			// 异常处理代码
			// ex.printStackTrace();
		}

		return list;
	}

	private Map<String, Object> getCurrentData(String strResult, String key) {
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			JSONTokener jsonParser = new JSONTokener(strResult);
			JSONObject js = (JSONObject) jsonParser.nextValue();
			map = ConvertJsonToList.getMap(js.getString(key));
		} catch (JSONException ex) {
			// 异常处理代码
			// ex.printStackTrace();
		}

		return map;
	}

	private long setEndTime(Map<String, Object> data) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		long endTime = 0;
		try {
			long a = sdf.parse(data.get("CurrentTime").toString()).getTime();
			long b = sdf.parse(data.get("EndTime").toString()).getTime();
			endTime = (b - a) / 1000;
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}
		return endTime;
	}

	private void initView() {
		buy_ssq_llfoot0 = (LinearLayout) findViewById(R.id.buy_ssq_llfoot0);
		buy_ssq_rlfoot1 = (RelativeLayout) findViewById(R.id.buy_ssq_rlfoot1);
		buy_ssqxh_llxiala = (LinearLayout) findViewById(R.id.buy_ssqxh_llxiala);
		buy_ssqxh_ll10kjdetail = (LinearLayout) findViewById(R.id.buy_ssqxh_ll10kjdetail);
		buy_ssq_llfoot0.setVisibility(View.VISIBLE);
		buy_ssq_rlfoot1.setVisibility(View.GONE);
		// 改变第一个框的背景，得到该对象
		buy_11x5_first_num = (LinearLayout) findViewById(R.id.buy_11x5_first_num);
		buy_11x5_first_text_layout = (LinearLayout) findViewById(R.id.buy_11x5_first_num_text_layout);
		buy_11x5_2nd_num = (LinearLayout) findViewById(R.id.buy_11x5_2nd_num);
		buy_11x5_3rd_num = (LinearLayout) findViewById(R.id.buy_11x5_3rd_num);

		buy_11x5_4th_num = (LinearLayout) findViewById(R.id.buy_11x5_4th_num);
		buy_11x5_5th_num = (LinearLayout) findViewById(R.id.buy_11x5_5th_num);
		buy_cqssc_first_dxds = (LinearLayout) findViewById(R.id.buy_cqssc_first_dxds);
		buy_cqssc_dxds_line = (View) findViewById(R.id.buy_cqssc_dxds_line);
		buy_cqssc_second_dxds = (LinearLayout) findViewById(R.id.buy_cqssc_second_dxds);
		buy_cqssc_wanqian_line = (View) findViewById(R.id.buy_cqssc_wanqian_line);
		buy_cqssc_qianbai_line = (View) findViewById(R.id.buy_cqssc_qianbai_line);
		buy_cqssc_baishi_line = (View) findViewById(R.id.buy_cqssc_baishi_line);
		buy_cqssc_shige_line = (View) findViewById(R.id.buy_cqssc_shige_line);
		// 初始化球
		initBall();
		// 初始化文本框
		initText();

		// 初始化button
		initButton();

		// 初始化下拉框
		initSelectPlayTypeView();
		// 初始化选择玩法五星，大小单双等时的 UI界面变化
		// initSPSelectView();
	}

	/**
	 * 初始化选择玩法五星，大小单双等时的 UI界面变化
	 */
	private void initSPSelectView() {
		if (strPlayType.equals("五星直选") || strPlayType.equals("五星通选") || strPlayType.equals("五星复选")) {
			buy_cqssc_first_dxds.setVisibility(View.GONE);
			buy_cqssc_dxds_line.setVisibility(View.GONE);
			buy_cqssc_second_dxds.setVisibility(View.GONE);
			buy_11x5_first_num.setVisibility(View.VISIBLE);
			buy_11x5_2nd_num.setVisibility(View.VISIBLE);
			buy_11x5_3rd_num.setVisibility(View.VISIBLE);
			buy_11x5_4th_num.setVisibility(View.VISIBLE);
			buy_11x5_5th_num.setVisibility(View.VISIBLE);
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.VISIBLE);
			buy_cqssc_qianbai_line.setVisibility(View.VISIBLE);
			buy_cqssc_baishi_line.setVisibility(View.VISIBLE);
			buy_cqssc_shige_line.setVisibility(View.VISIBLE);
			buy_cqssc_5th_geweiName.setVisibility(View.VISIBLE);
		} else if (strPlayType.equals("三星直选") || strPlayType.equals("三星复选")) {
			buy_cqssc_first_dxds.setVisibility(View.GONE);
			buy_cqssc_dxds_line.setVisibility(View.GONE);
			buy_cqssc_second_dxds.setVisibility(View.GONE);
			buy_11x5_first_num.setVisibility(View.GONE);
			buy_11x5_2nd_num.setVisibility(View.GONE);
			buy_11x5_3rd_num.setVisibility(View.VISIBLE);
			buy_11x5_4th_num.setVisibility(View.VISIBLE);
			buy_11x5_5th_num.setVisibility(View.VISIBLE);
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.GONE);
			buy_cqssc_qianbai_line.setVisibility(View.GONE);
			buy_cqssc_baishi_line.setVisibility(View.VISIBLE);
			buy_cqssc_shige_line.setVisibility(View.VISIBLE);
			buy_cqssc_5th_geweiName.setVisibility(View.VISIBLE);
		} else if (strPlayType.equals("二星直选") || strPlayType.equals("二星复选")) {
			buy_cqssc_first_dxds.setVisibility(View.GONE);
			buy_cqssc_dxds_line.setVisibility(View.GONE);
			buy_cqssc_second_dxds.setVisibility(View.GONE);
			buy_11x5_first_num.setVisibility(View.GONE);
			buy_11x5_2nd_num.setVisibility(View.GONE);
			buy_11x5_3rd_num.setVisibility(View.GONE);
			buy_11x5_4th_num.setVisibility(View.VISIBLE);
			buy_11x5_5th_num.setVisibility(View.VISIBLE);
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.GONE);
			buy_cqssc_qianbai_line.setVisibility(View.GONE);
			buy_cqssc_baishi_line.setVisibility(View.GONE);
			buy_cqssc_shige_line.setVisibility(View.VISIBLE);
			buy_cqssc_5th_geweiName.setVisibility(View.VISIBLE);
		} else if (strPlayType.equals("二星组选")) {
			buy_cqssc_first_dxds.setVisibility(View.GONE);
			buy_cqssc_dxds_line.setVisibility(View.GONE);
			buy_cqssc_second_dxds.setVisibility(View.GONE);
			buy_11x5_first_num.setVisibility(View.GONE);
			buy_11x5_2nd_num.setVisibility(View.GONE);
			buy_11x5_3rd_num.setVisibility(View.GONE);
			buy_11x5_4th_num.setVisibility(View.GONE);
			buy_11x5_5th_num.setVisibility(View.VISIBLE);// 个位
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.GONE);
			buy_cqssc_qianbai_line.setVisibility(View.GONE);
			buy_cqssc_baishi_line.setVisibility(View.GONE);
			buy_cqssc_shige_line.setVisibility(View.GONE);
			buy_cqssc_5th_geweiName.setVisibility(View.GONE);
		} else if (strPlayType.equals("一星复式")) {
			buy_cqssc_first_dxds.setVisibility(View.GONE);
			buy_cqssc_dxds_line.setVisibility(View.GONE);
			buy_cqssc_second_dxds.setVisibility(View.GONE);
			buy_11x5_first_num.setVisibility(View.GONE);
			buy_11x5_2nd_num.setVisibility(View.GONE);
			buy_11x5_3rd_num.setVisibility(View.GONE);
			buy_11x5_4th_num.setVisibility(View.GONE);
			buy_11x5_5th_num.setVisibility(View.VISIBLE);// 个位
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.GONE);
			buy_cqssc_qianbai_line.setVisibility(View.GONE);
			buy_cqssc_baishi_line.setVisibility(View.GONE);
			buy_cqssc_shige_line.setVisibility(View.GONE);
			buy_cqssc_5th_geweiName.setVisibility(View.VISIBLE);
		} else if (strPlayType.equals("大小单双复式")) {
			buy_cqssc_first_dxds.setVisibility(View.VISIBLE);
			buy_cqssc_dxds_line.setVisibility(View.VISIBLE);
			buy_cqssc_second_dxds.setVisibility(View.VISIBLE);
			buy_11x5_first_num.setVisibility(View.GONE);
			buy_11x5_2nd_num.setVisibility(View.GONE);
			buy_11x5_3rd_num.setVisibility(View.GONE);
			buy_11x5_4th_num.setVisibility(View.GONE);
			buy_11x5_5th_num.setVisibility(View.GONE);
			// 分割线
			buy_cqssc_wanqian_line.setVisibility(View.GONE);
			buy_cqssc_qianbai_line.setVisibility(View.GONE);
			buy_cqssc_baishi_line.setVisibility(View.GONE);
			buy_cqssc_shige_line.setVisibility(View.GONE);
			buy_cqssc_5th_geweiName.setVisibility(View.GONE);
		}
	}

	/**
	 * 初始化玩法说明
	 */
	// private void setPlayTypeExplainText() {
	// if (strPlayType.equals("五星直选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[0];
	// } else if (strPlayType.equals("五星通选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[1];
	// } else if (strPlayType.equals("五星复选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[2];
	// } else if (strPlayType.equals("三星直选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[3];
	// } else if (strPlayType.equals("三星复选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[4];
	// } else if (strPlayType.equals("二星直选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[5];
	// } else if (strPlayType.equals("二星组选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[6];
	// } else if (strPlayType.equals("二星复选")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[7];
	// } else if (strPlayType.equals("一星复式")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[8];
	// } else if (strPlayType.equals("大小单双复式")) {
	// playTypeExplain =
	// context.getResources().getStringArray(R.array.buy_cqssc_playtype_info)[9];
	// }
	// // modeDES.setText(playTypeExplain);
	// }

	/**
	 * 获取玩法Id
	 */
	private void setplayTypeId() {
		if (strPlayType.equals("五星直选")) {
			playTypeId = 2803;
		} else if (strPlayType.equals("五星通选")) {
			playTypeId = 2806;
		} else if (strPlayType.equals("五星复选")) {
			playTypeId = 2802;
		} else if (strPlayType.equals("三星直选")) {
			playTypeId = 2803;
		} else if (strPlayType.equals("三星复选")) {
			playTypeId = 2802;
		} else if (strPlayType.equals("二星直选")) {
			playTypeId = 2803;
		} else if (strPlayType.equals("二星组选")) {
			playTypeId = 2808;
		} else if (strPlayType.equals("二星复选")) {
			playTypeId = 2802;
		} else if (strPlayType.equals("一星复式")) {
			playTypeId = 2803;
		} else if (strPlayType.equals("大小单双复式")) {
			playTypeId = 2804;
		}
	}

	public void initBall() {
		// 初始化大小单双1球
		initDXDS1stBall();

		// 初始化大小单双2球
		initDXDS2ndBall();

		if (!strPlayType.equals("五星复选") && !strPlayType.equals("三星复选") && !strPlayType.equals("二星复选")) {
			// 初始化球 万位
			init1stBall();

			// 初始化第2位球 千
			init2ndBall();

			// 初始化第3位球 百
			init3rdBall();

			// 初始化第4位球 十
			init4thBall();

			// 初始化第5位球 个
			init5thBall();
		} else {
			// 初始化球 万位
			init1stSingleBall();

			// 初始化第2位球 千
			init2ndSingleBall();

			// 初始化第3位球 百
			init3rdSingleBall();

			// 初始化第4位球 十
			init4thSingleBall();

			// 初始化第5位球 个
			init5thSingleBall();
		}

	}

	/**
	 * 机选及晃动手机
	 */
	public void initRandomBall() {
		initBall();
		ball_wanwei_dintInt = new DynArrayInt();
		ball_qianwei_dintInt = new DynArrayInt();
		ball_baiwei_dintInt = new DynArrayInt();
		ball_shiwei_dintInt = new DynArrayInt();
		ball_gewei_dintInt = new DynArrayInt();
		ball_dxdsShi_dintInt = new DynArrayInt();
		ball_dxdsGe_dintInt = new DynArrayInt();

		ball_wanwei_dintInt.removeAll();
		ball_qianwei_dintInt.removeAll();
		ball_baiwei_dintInt.removeAll();
		ball_shiwei_dintInt.removeAll();
		ball_gewei_dintInt.removeAll();
		ball_dxdsShi_dintInt.removeAll();
		ball_dxdsGe_dintInt.removeAll();
		if (strPlayType.equals("五星直选") || strPlayType.equals("五星通选") || strPlayType.equals("五星复选")) {
			randomDirectFive();
		} else if (strPlayType.equals("三星直选") || strPlayType.equals("三星复选")) {
			randomDirectThree();
		} else if (strPlayType.equals("二星直选") || strPlayType.equals("二星复选")) {
			randomDirectTwo();
		} else if (strPlayType.equals("一星复式") || strPlayType.equals("二星组选")) {
			// 开始随机号码
			int ball_random[] = RandomGenData(0, 9, getRandomNum(), "gewei");
			// 追加数组到ball_1st_dintInt中
			ball_gewei_dintInt.addInt(ball_random);
			// randomDirectOne();
		} else if (strPlayType.equals("大小单双复式")) {
			randomDirectDXDS();
		}
		getMoneyInfo();
	}

	/**
	 * 大小单双随机
	 * 
	 * @return
	 */
	public String randomDirectDXDS() {
		String ball = "";
		int shiwei_ball[] = RandomGenData(0, 3, 1, "shiwei");
		int gewei_ball[] = RandomGenData(0, 3, 1, "gewei");
		// // 判断是否有重复数字
		// if (shiwei_ball[0] == gewei_ball[0]) {
		// initBall();
		// randomDirectDXDS();
		// } else {
		// ball_dxdsShi_dintInt = new DynArrayInt();
		// ball_dxdsGe_dintInt = new DynArrayInt();
		//
		// ball_dxdsShi_dintInt.addInt(shiwei_ball);
		// ball_dxdsGe_dintInt.addInt(gewei_ball);
		// String shiwei = ball_dxdsShi_dintInt.getIntToStringForSingle(0);
		// String gewei = ball_dxdsGe_dintInt.getIntToStringForSingle(0);
		// // 可能有大小单双转化 string 0123
		// ball = shiwei + "|" + gewei;
		// }
		ball_dxdsShi_dintInt = new DynArrayInt();
		ball_dxdsGe_dintInt = new DynArrayInt();

		ball_dxdsShi_dintInt.addInt(shiwei_ball);
		ball_dxdsGe_dintInt.addInt(gewei_ball);
		String shiwei = ball_dxdsShi_dintInt.getIntToStringForSingle(0);
		String gewei = ball_dxdsGe_dintInt.getIntToStringForSingle(0);
		// 可能有大小单双转化 string 0123
		ball = shiwei + "|" + gewei;
		Log.d("randomDirectDXDS", "ball= " + ball);
		return ball;
	}

	public String randomDirectTwo() {
		String ball = "";
		int shiwei_ball[] = RandomGenData(0, 9, 1, "shiwei");
		int gewei_ball[] = RandomGenData(0, 9, 1, "gewei");
		// // 判断是否有重复数字
		// if (shiwei_ball[0] == gewei_ball[0]) {
		// initBall();
		// randomDirectTwo();
		// } else {
		// ball_shiwei_dintInt = new DynArrayInt();
		// ball_gewei_dintInt = new DynArrayInt();
		//
		// ball_shiwei_dintInt.addInt(shiwei_ball);
		// ball_gewei_dintInt.addInt(gewei_ball);
		// String shiwei = ball_shiwei_dintInt.getIntToStringForSingle(0);
		// String gewei = ball_gewei_dintInt.getIntToStringForSingle(0);
		// ball = shiwei + "|" + gewei;
		// }
		ball_shiwei_dintInt = new DynArrayInt();
		ball_gewei_dintInt = new DynArrayInt();

		ball_shiwei_dintInt.addInt(shiwei_ball);
		ball_gewei_dintInt.addInt(gewei_ball);
		String shiwei = ball_shiwei_dintInt.getIntToStringForSingle(0);
		String gewei = ball_gewei_dintInt.getIntToStringForSingle(0);
		ball = shiwei + "|" + gewei;
		Log.d("randomDirectTwo", "ball= " + ball);
		return ball;
	}

	public String randomDirectThree() {
		String ball = "";
		int baiwei_ball[] = RandomGenData(0, 9, 1, "baiwei");
		int shiwei_ball[] = RandomGenData(0, 9, 1, "shiwei");
		int gewei_ball[] = RandomGenData(0, 9, 1, "gewei");
		// // 判断是否有重复数字
		// if (baiwei_ball[0] == shiwei_ball[0] || shiwei_ball[0] ==
		// gewei_ball[0] || gewei_ball[0] == baiwei_ball[0]) {
		// initBall();
		// randomDirectThree();
		// } else {
		// ball_baiwei_dintInt = new DynArrayInt();
		// ball_shiwei_dintInt = new DynArrayInt();
		// ball_gewei_dintInt = new DynArrayInt();
		//
		// ball_baiwei_dintInt.addInt(baiwei_ball);
		// ball_shiwei_dintInt.addInt(shiwei_ball);
		// ball_gewei_dintInt.addInt(gewei_ball);
		//
		// String baiwei = ball_baiwei_dintInt.getIntToStringForSingle(0);
		// String shiwei = ball_shiwei_dintInt.getIntToStringForSingle(0);
		// String gewei = ball_gewei_dintInt.getIntToStringForSingle(0);
		// ball = baiwei + "|" + shiwei + "|" + gewei;
		// }
		ball_baiwei_dintInt = new DynArrayInt();
		ball_shiwei_dintInt = new DynArrayInt();
		ball_gewei_dintInt = new DynArrayInt();

		ball_baiwei_dintInt.addInt(baiwei_ball);
		ball_shiwei_dintInt.addInt(shiwei_ball);
		ball_gewei_dintInt.addInt(gewei_ball);

		String baiwei = ball_baiwei_dintInt.getIntToStringForSingle(0);
		String shiwei = ball_shiwei_dintInt.getIntToStringForSingle(0);
		String gewei = ball_gewei_dintInt.getIntToStringForSingle(0);
		ball = baiwei + "|" + shiwei + "|" + gewei;
		Log.d("randomDirectThree", "ball= " + ball);
		return ball;
	}

	public String randomDirectFive() {
		String ball = "";
		int first_ball[] = RandomGenData(0, 9, 1, "wanwei");
		int second_ball[] = RandomGenData(0, 9, 1, "qianwei");
		int third_ball[] = RandomGenData(0, 9, 1, "baiwei");
		int fourth_ball[] = RandomGenData(0, 9, 1, "shiwei");
		int fifth_ball[] = RandomGenData(0, 9, 1, "gewei");
		// // 判断是否有重复数字,待测试
		// if (first_ball[0] == second_ball[0] || second_ball[0] ==
		// third_ball[0] || third_ball[0] == first_ball[0] || fourth_ball[0] ==
		// third_ball[0] || fourth_ball[0] == fifth_ball[0]) {
		// initBall();
		// randomDirectFive();
		// } else {
		// ball_wanwei_dintInt = new DynArrayInt();
		// ball_qianwei_dintInt = new DynArrayInt();
		// ball_baiwei_dintInt = new DynArrayInt();
		// ball_shiwei_dintInt = new DynArrayInt();
		// ball_gewei_dintInt = new DynArrayInt();
		//
		// ball_wanwei_dintInt.addInt(first_ball);
		// ball_qianwei_dintInt.addInt(second_ball);
		// ball_baiwei_dintInt.addInt(third_ball);
		// ball_shiwei_dintInt.addInt(fourth_ball);
		// ball_gewei_dintInt.addInt(fifth_ball);
		//
		// String first = ball_wanwei_dintInt.getIntToStringForSingle(0);
		// String second = ball_qianwei_dintInt.getIntToStringForSingle(0);
		// String third = ball_baiwei_dintInt.getIntToStringForSingle(0);
		// String fourth = ball_shiwei_dintInt.getIntToStringForSingle(0);
		// String fifth = ball_gewei_dintInt.getIntToStringForSingle(0);
		// ball = first + "|" + second + "|" + third + "|" + fourth + "|" +
		// fifth;
		// }
		ball_wanwei_dintInt = new DynArrayInt();
		ball_qianwei_dintInt = new DynArrayInt();
		ball_baiwei_dintInt = new DynArrayInt();
		ball_shiwei_dintInt = new DynArrayInt();
		ball_gewei_dintInt = new DynArrayInt();

		ball_wanwei_dintInt.addInt(first_ball);
		ball_qianwei_dintInt.addInt(second_ball);
		ball_baiwei_dintInt.addInt(third_ball);
		ball_shiwei_dintInt.addInt(fourth_ball);
		ball_gewei_dintInt.addInt(fifth_ball);

		String first = ball_wanwei_dintInt.getIntToStringForSingle(0);
		String second = ball_qianwei_dintInt.getIntToStringForSingle(0);
		String third = ball_baiwei_dintInt.getIntToStringForSingle(0);
		String fourth = ball_shiwei_dintInt.getIntToStringForSingle(0);
		String fifth = ball_gewei_dintInt.getIntToStringForSingle(0);
		ball = first + "|" + second + "|" + third + "|" + fourth + "|" + fifth;
		Log.d("randomDirectFive", "ball= " + ball);
		return ball;
	}

	// 随机取球，并显示
	public int[] RandomGenData(int min, int max, int num, String position) {
		int[] temp;
		Random rndNumber;
		rndNumber = new Random();
		temp = new int[num];
		List<Integer> a1 = new ArrayList<Integer>();

		for (int i = min; i <= max; i++) {
			a1.add((Integer) i);

		}
		// Log.v("RandomGenData", "position= " + position);
		for (int i = 0; i < num; i++) {
			int index = rndNumber.nextInt(max - min + 1 - i);
			Object o = a1.get(index);
			temp[i] = ((Integer) o).intValue();
			// Log.e("RandomGenData", "temp[i]= " + temp[i]);
			if (strPlayType.equals("大小单双复式")) {
				if (position.equals("shiwei"))
					BallRandomDXDS(1, 0, temp[i]);
				if (position.equals("gewei"))
					BallRandomDXDS(0, 1, temp[i]);
			} else {
				if (position.equals("wanwei"))
					BallRandom5(1, 0, 0, 0, 0, temp[i]);
				if (position.equals("qianwei"))
					BallRandom5(0, 1, 0, 0, 0, temp[i]);
				if (position.equals("baiwei"))
					BallRandom5(0, 0, 1, 0, 0, temp[i]);
				if (position.equals("shiwei"))
					BallRandom5(0, 0, 0, 1, 0, temp[i]);
				if (position.equals("gewei"))
					BallRandom5(0, 0, 0, 0, 1, temp[i]);
			}
			a1.remove(index);
		}
		Arrays.sort(temp);
		// for (int i = 0; i < temp.length; i++) {
		// System.out.println("RandomGenData 随机取球，并显示 temp[i]" + temp[i]);
		// }
		return temp;
	}

	// 显示注数和金钱
	public void getMoneyInfo() {
		int money;
		count = 0;
		if (strPlayType.equals("五星直选") || strPlayType.equals("五星通选")) {
			int a = ball_wanwei_dintInt.getSize();
			int b = ball_qianwei_dintInt.getSize();
			int c = ball_baiwei_dintInt.getSize();
			int d = ball_shiwei_dintInt.getSize();
			int e = ball_gewei_dintInt.getSize();
			count += a * b * c * d * e;
		} else if (strPlayType.equals("五星复选")) {
			int a = ball_wanwei_dintInt.getSize();
			int b = ball_qianwei_dintInt.getSize();
			int c = ball_baiwei_dintInt.getSize();
			int d = ball_shiwei_dintInt.getSize();
			int e = ball_gewei_dintInt.getSize();
			count += 4 * a * b * c * d * e;
		} else if (strPlayType.equals("三星直选")) {
			int a = ball_baiwei_dintInt.getSize();
			int b = ball_shiwei_dintInt.getSize();
			int c = ball_gewei_dintInt.getSize();
			// Log.v("三星", "a= "+a);
			// Log.v("三星", "b= "+b);
			// Log.v("三星", "c= "+c);
			count += a * b * c;
		} else if (strPlayType.equals("三星复选")) {
			int a = ball_baiwei_dintInt.getSize();
			int b = ball_shiwei_dintInt.getSize();
			int c = ball_gewei_dintInt.getSize();
			// Log.v("三星", "a= "+a);
			// Log.v("三星", "b= "+b);
			// Log.v("三星", "c= "+c);
			count += 3 * a * b * c;
		} else if (strPlayType.equals("二星直选")) {
			int a = ball_shiwei_dintInt.getSize();
			int b = ball_gewei_dintInt.getSize();
			count += a * b;
		} else if (strPlayType.equals("二星复选")) {
			int a = ball_shiwei_dintInt.getSize();
			int b = ball_gewei_dintInt.getSize();
			count += 2 * a * b;
		} else if (strPlayType.equals("二星组选")) {
			int a = ball_gewei_dintInt.getSize();// 组合c a 2
			if (a == 0 || a == 1) {
				count = 0;
			} else if (a == 2) {
				count = 1;
			} else if (a == 3) {
				count = 3;
			} else if (a == 4) {
				count = 6;
			} else if (a == 5) {
				count = 10;
			} else if (a == 6) {
				count = 15;
			} else if (a == 7) {
				count = 21;
			} else if (a == 8) {
				count = 28;
			} else if (a == 9) {
				count = 36;
			} else if (a == 10) {
				count = 45;
			}
		} else if (strPlayType.equals("一星复式")) {
			int a = ball_gewei_dintInt.getSize();
			count += a;
		} else if (strPlayType.equals("大小单双复式")) {
			int a = ball_dxdsShi_dintInt.getSize();
			int b = ball_dxdsGe_dintInt.getSize();
			count += a * b;
		}
		// Log.v("getMoneyInfo", "count= "+count);
		money = count * 2;
		allMoney = money;
		countText.setText(count + "");
		moneyText.setText(Html.fromHtml("<font color='#fe5052'>"+money+"</font>" + " 元"));

		// 计算总奖金
		// 奖金
		int totalmoney = Kuai3Util.getCqsscMoney(strPlayType);
		prizeIntellChase = totalmoney;
		if (money == 0) {
			tvJiangJin.setText(context.getString(R.string.buy_show_jiangjin));
		} else {
			String strjiangjin = ".若中奖：奖金" + totalmoney + "元，盈利" + (totalmoney - money) + "元";
			tvJiangJin.setText(strjiangjin);
		}

		if (count == 0) {
			buy_ssq_llfoot0.setVisibility(View.VISIBLE);
			buy_ssq_rlfoot1.setVisibility(View.GONE);
		} else {
			buy_ssq_llfoot0.setVisibility(View.GONE);
			buy_ssq_rlfoot1.setVisibility(View.VISIBLE);
		}
	}

	public void BallRandomDXDS(int a, int b, int num) {
		if (num == 0 && a == 1) {
			imButtond_dxds1_01.setSelected(true);
		}
		if (num == 1 && a == 1) {
			imButtond_dxds1_02.setSelected(true);
		}
		if (num == 2 && a == 1) {
			imButtond_dxds1_03.setSelected(true);
		}
		if (num == 3 && a == 1) {
			imButtond_dxds1_04.setSelected(true);
		}

		if (num == 0 && b == 1) {
			imButtond_dxds2_01.setSelected(true);
		}
		if (num == 1 && b == 1) {
			imButtond_dxds2_02.setSelected(true);
		}
		if (num == 2 && b == 1) {
			imButtond_dxds2_03.setSelected(true);
		}
		if (num == 3 && b == 1) {
			imButtond_dxds2_04.setSelected(true);
		}
	}

	public void BallRandom5(int a, int b, int c, int d, int e, int num) {
		if (num == 0 && a == 1) {
			imButton01.setSelected(true);
		}
		if (num == 1 && a == 1) {
			imButton02.setSelected(true);
		}
		if (num == 2 && a == 1) {
			imButton03.setSelected(true);
		}
		if (num == 3 && a == 1) {
			imButton04.setSelected(true);
		}
		if (num == 4 && a == 1) {
			imButton05.setSelected(true);
		}
		if (num == 5 && a == 1) {
			imButton06.setSelected(true);
		}
		if (num == 6 && a == 1) {
			imButton07.setSelected(true);
		}
		if (num == 7 && a == 1) {
			imButton08.setSelected(true);
		}
		if (num == 8 && a == 1) {
			imButton09.setSelected(true);
		}
		if (num == 9 && a == 1) {
			imButton10.setSelected(true);
		}

		if (num == 0 && b == 1) {
			imButtonb_01.setSelected(true);

		}
		if (num == 1 && b == 1) {
			imButtonb_02.setSelected(true);
		}
		if (num == 2 && b == 1) {
			imButtonb_03.setSelected(true);
		}
		if (num == 3 && b == 1) {
			imButtonb_04.setSelected(true);
		}
		if (num == 4 && b == 1) {
			imButtonb_05.setSelected(true);
		}
		if (num == 5 && b == 1) {
			imButtonb_06.setSelected(true);
		}
		if (num == 6 && b == 1) {
			imButtonb_07.setSelected(true);
		}
		if (num == 7 && b == 1) {
			imButtonb_08.setSelected(true);
		}
		if (num == 8 && b == 1) {
			imButtonb_09.setSelected(true);
		}
		if (num == 9 && b == 1) {
			imButtonb_10.setSelected(true);
		}

		if (num == 0 && c == 1) {
			imButtonc_01.setSelected(true);
		}
		if (num == 1 && c == 1) {
			imButtonc_02.setSelected(true);
		}
		if (num == 2 && c == 1) {
			imButtonc_03.setSelected(true);
		}
		if (num == 3 && c == 1) {
			imButtonc_04.setSelected(true);
		}
		if (num == 4 && c == 1) {
			imButtonc_05.setSelected(true);
		}
		if (num == 5 && c == 1) {
			imButtonc_06.setSelected(true);
		}
		if (num == 6 && c == 1) {
			imButtonc_07.setSelected(true);
		}
		if (num == 7 && c == 1) {
			imButtonc_08.setSelected(true);
		}
		if (num == 8 && c == 1) {
			imButtonc_09.setSelected(true);
		}
		if (num == 9 && c == 1) {
			imButtonc_10.setSelected(true);
		}

		if (num == 0 && d == 1) {
			imButtond_01.setSelected(true);

		}
		if (num == 1 && d == 1) {
			imButtond_02.setSelected(true);
		}
		if (num == 2 && d == 1) {
			imButtond_03.setSelected(true);
		}
		if (num == 3 && d == 1) {
			imButtond_04.setSelected(true);
		}
		if (num == 4 && d == 1) {
			imButtond_05.setSelected(true);
		}
		if (num == 5 && d == 1) {
			imButtond_06.setSelected(true);
		}
		if (num == 6 && d == 1) {
			imButtond_07.setSelected(true);
		}
		if (num == 7 && d == 1) {
			imButtond_08.setSelected(true);
		}
		if (num == 8 && d == 1) {
			imButtond_09.setSelected(true);
		}
		if (num == 9 && d == 1) {
			imButtond_10.setSelected(true);
		}

		if (num == 0 && e == 1) {
			imButtone_01.setSelected(true);
		}
		if (num == 1 && e == 1) {
			imButtone_02.setSelected(true);
		}
		if (num == 2 && e == 1) {
			imButtone_03.setSelected(true);
		}
		if (num == 3 && e == 1) {
			imButtone_04.setSelected(true);
		}
		if (num == 4 && e == 1) {
			imButtone_05.setSelected(true);
		}
		if (num == 5 && e == 1) {
			imButtone_06.setSelected(true);
		}
		if (num == 6 && e == 1) {
			imButtone_07.setSelected(true);
		}
		if (num == 7 && e == 1) {
			imButtone_08.setSelected(true);
		}
		if (num == 8 && e == 1) {
			imButtone_09.setSelected(true);
		}
		if (num == 9 && e == 1) {
			imButtone_10.setSelected(true);
		}
	}

	private int getRandomNum() {
		int num = 0;
		if (strPlayType.equals("五星直选") || strPlayType.equals("五星通选") || strPlayType.equals("五星复选")) {
			num = 5;
		} else if (strPlayType.equals("三星直选") || strPlayType.equals("三星复选")) {
			num = 3;
		} else if (strPlayType.equals("二星直选") || strPlayType.equals("二星组选") || strPlayType.equals("二星复选")
				|| strPlayType.equals("大小单双复式")) {
			num = 2;
		} else if (strPlayType.equals("一星复式")) {
			num = 1;
		}
		return num;
	}

	// // 初始化下拉框
	// public void initSpinner() {
	// String countries[] = new String[] { "二星", "一星", "大小单双", "五星", "三星" };
	// final WheelView country = (WheelView) findViewById(R.id.wheel_country);
	// // 国家显示3条数据
	// country.setVisibleItems(3);
	// // 设置滚轮数据可循环
	// country.setCyclic(true);
	// // 设置自定义的数组滚轮适配器
	// country.setAdapter(new ArrayWheelAdapter<String>(countries));
	//
	// final String cities[][] = new String[][] { new String[] { "直选", "组选",
	// "复选" }, new String[] { "复式" }, new String[] { "复式" }, new String[] {
	// "直选", "通选", "复选" }, new String[] { "直选", "复选" }, };
	//
	// final WheelView city = (WheelView) findViewById(R.id.wheel_city);
	// // 具体玩法显示3条数据
	// city.setVisibleItems(3);
	// // 设置滚轮数据可循环
	// // city.setCyclic(true);
	// city.setCyclic(false);
	//
	// // 增加监听，当国家信息变化时，城市信息随之变化
	// country.addChangingListener(new OnWheelChangedListener() {
	// public void onChanged(WheelView wheel, int oldValue, int newValue) {
	// city.setAdapter(new ArrayWheelAdapter<String>(cities[newValue]));
	// // 当前显示的数据的位置
	// city.setCurrentItem(cities[newValue].length / 2);
	// int currentCountry = country.getCurrentItem();
	// int currentCity = city.getCurrentItem();
	// String countryStr = country.getAdapter().getItem(currentCountry);
	// String cityStr = city.getAdapter().getItem(currentCity);
	// // Log.i("PDA", "国家：" + countryStr + "||" + "城市：" + cityStr);
	// // Log.i("PDA", "玩法：" + countryStr + "||" + "具体玩法：" + cityStr);
	// // txt_result.setText("您选择的是：" + countryStr + "" + cityStr);
	// Log.i("CQSSC", "country addChangingListener您选择的是：" + countryStr + "" +
	// cityStr);
	// strPlayType = countryStr + "" + cityStr;
	// setPlayTypeExplainText();
	//
	// initSPSelectView();
	// initBall();
	// allMoney = 0;
	// count = 0;
	// countText.setText(0 + "");
	// moneyText.setText(0 + "");
	//
	// }
	//
	// });
	// country.setCurrentItem(-1);
	//
	// // 城市信息变化时，也随之动态改变文字
	// city.addChangingListener(new OnWheelChangedListener() {
	// public void onChanged(WheelView wheel, int oldValue, int newValue) {
	// // TODO Auto-generated method stub
	// int currentCountry = country.getCurrentItem();
	// int currentCity = city.getCurrentItem();
	// String countryStr = country.getAdapter().getItem(currentCountry);
	// String cityStr = city.getAdapter().getItem(currentCity);
	// // Log.i("PDA", "国家：" + countryStr + "||" + "城市：" + cityStr);
	// // Log.i("PDA", "玩法：" + countryStr + "||" + "具体玩法：" + cityStr);
	// // if (txt_result == null) {
	// // txt_result.setText("");
	// // }
	// // txt_result.setText("您选择的是：" + countryStr + "" + cityStr);
	// Log.v("CQSSC", "city.addChangingListener您选择的是：" + countryStr + "" +
	// cityStr);
	// strPlayType = countryStr + "" + cityStr;
	//
	// setPlayTypeExplainText();
	//
	// initSPSelectView();
	// initBall();
	// allMoney = 0;
	// count = 0;
	// countText.setText(0 + "");
	// moneyText.setText(0 + "");
	//
	// }
	// });
	//
	// }

	// Button初始化
	public void initButton() {
		buy_11x5_random = (Button) findViewById(R.id.buy_11x5_random);// 机选
		buy_ssqxh_Button03 = (LinearLayout) findViewById(R.id.buy_ssqxh_Button03);//
		buy_ssqxh_Button04 = (LinearLayout) findViewById(R.id.buy_ssqxh_Button04);
		buy_11x5_clear = (Button) findViewById(R.id.buy_11x5_clear);// 清空选择
		buy_11x5_submit = (Button) findViewById(R.id.buy_11x5_submit);// 确认选择

	}

	private void initText() {
		currentIssue = (TextView) findViewById(R.id.buy_11x5_currentissue);
		endTimeText = (TextView) findViewById(R.id.buy_11x5_endtime);
		endTimeText.setText("--------------");
		// modeDES = (TextView) findViewById(R.id.buy_11x5_mode_des);
		countText = (TextView) findViewById(R.id.buy_11x5_count);
		moneyText = (TextView) findViewById(R.id.buy_11x5_amount);
		buy_cqssc_5th_geweiName = (LinearLayout) findViewById(R.id.buy_cqssc_5th_geweiName);
		tvJiangJin = (TextView) findViewById(R.id.tvJiangJin);
		// currentIssue.setText(mData.get("IssueName").toString());
		// endTime.setText(mData.get("EndTime").toString());
	}

	public void initDXDS1stBall() {
		ball_dxdsShi_dintInt = new DynArrayInt();

		imButtond_dxds1_01 = (Button) findViewById(R.id.buy_dxds1_imageButton01);
		imButtond_dxds1_01.setSelected(false);
		imButtond_dxds1_01.setText("大");
		imButtond_dxds1_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if (!imButtond_dxds1_02.isSelected() && (!imButtond_dxds1_03.isSelected())
						&& (!imButtond_dxds1_04.isSelected())) {
					if (imButtond_dxds1_01.isSelected()) {
						imButtond_dxds1_01.setSelected(false);
						ball_dxdsShi_dintInt.remove(0);

					} else {
						imButtond_dxds1_01.setSelected(true);
						ball_dxdsShi_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds1_02 = (Button) findViewById(R.id.buy_dxds1_imageButton02);
		imButtond_dxds1_02.setSelected(false);
		imButtond_dxds1_02.setText("小");
		imButtond_dxds1_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds1_01.isSelected() && (!imButtond_dxds1_03.isSelected())
						&& (!imButtond_dxds1_04.isSelected())) {
					if (imButtond_dxds1_02.isSelected()) {
						imButtond_dxds1_02.setSelected(false);
						ball_dxdsShi_dintInt.remove(1);

					} else {
						imButtond_dxds1_02.setSelected(true);
						ball_dxdsShi_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds1_03 = (Button) findViewById(R.id.buy_dxds1_imageButton03);
		imButtond_dxds1_03.setSelected(false);
		imButtond_dxds1_03.setText("单");
		imButtond_dxds1_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds1_01.isSelected() && (!imButtond_dxds1_02.isSelected())
						&& (!imButtond_dxds1_04.isSelected())) {
					if (imButtond_dxds1_03.isSelected()) {
						imButtond_dxds1_03.setSelected(false);
						ball_dxdsShi_dintInt.remove(2);

					} else {
						imButtond_dxds1_03.setSelected(true);
						ball_dxdsShi_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds1_04 = (Button) findViewById(R.id.buy_dxds1_imageButton04);
		imButtond_dxds1_04.setSelected(false);
		imButtond_dxds1_04.setText("双");
		imButtond_dxds1_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds1_01.isSelected() && (!imButtond_dxds1_02.isSelected())
						&& (!imButtond_dxds1_03.isSelected())) {
					if (imButtond_dxds1_04.isSelected()) {
						imButtond_dxds1_04.setSelected(false);
						ball_dxdsShi_dintInt.remove(3);

					} else {
						imButtond_dxds1_04.setSelected(true);
						ball_dxdsShi_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});
	}

	public void initDXDS2ndBall() {
		ball_dxdsGe_dintInt = new DynArrayInt();

		imButtond_dxds2_01 = (Button) findViewById(R.id.buy_dxds2_imageButton01);
		imButtond_dxds2_01.setSelected(false);
		imButtond_dxds2_01.setText("大");
		imButtond_dxds2_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds2_02.isSelected() && (!imButtond_dxds2_03.isSelected())
						&& (!imButtond_dxds2_04.isSelected())) {
					if (imButtond_dxds2_01.isSelected()) {
						imButtond_dxds2_01.setSelected(false);
						ball_dxdsGe_dintInt.remove(0);

					} else {
						imButtond_dxds2_01.setSelected(true);
						ball_dxdsGe_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds2_02 = (Button) findViewById(R.id.buy_dxds2_imageButton02);
		imButtond_dxds2_02.setSelected(false);
		imButtond_dxds2_02.setText("小");
		imButtond_dxds2_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds2_01.isSelected() && (!imButtond_dxds2_03.isSelected())
						&& (!imButtond_dxds2_04.isSelected())) {
					if (imButtond_dxds2_02.isSelected()) {
						imButtond_dxds2_02.setSelected(false);
						ball_dxdsGe_dintInt.remove(1);

					} else {
						imButtond_dxds2_02.setSelected(true);
						ball_dxdsGe_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds2_03 = (Button) findViewById(R.id.buy_dxds2_imageButton03);
		imButtond_dxds2_03.setSelected(false);
		imButtond_dxds2_03.setText("单");
		imButtond_dxds2_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds2_01.isSelected() && (!imButtond_dxds2_02.isSelected())
						&& (!imButtond_dxds2_04.isSelected())) {
					if (imButtond_dxds2_03.isSelected()) {
						imButtond_dxds2_03.setSelected(false);
						ball_dxdsGe_dintInt.remove(2);

					} else {
						imButtond_dxds2_03.setSelected(true);
						ball_dxdsGe_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});

		imButtond_dxds2_04 = (Button) findViewById(R.id.buy_dxds2_imageButton04);
		imButtond_dxds2_04.setSelected(false);
		imButtond_dxds2_04.setText("双");
		imButtond_dxds2_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!imButtond_dxds2_01.isSelected() && (!imButtond_dxds2_02.isSelected())
						&& (!imButtond_dxds2_03.isSelected())) {
					if (imButtond_dxds2_04.isSelected()) {
						imButtond_dxds2_04.setSelected(false);
						ball_dxdsGe_dintInt.remove(3);

					} else {
						imButtond_dxds2_04.setSelected(true);
						ball_dxdsGe_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}

				getMoneyInfo();
			}
		});
	}

	public void init1stBall() {
		ball_wanwei_dintInt = new DynArrayInt();
		// 万位
		imButton01 = (Button) findViewById(R.id.buy_11x5_imageButton01);
		imButton01.setSelected(false);
		imButton01.setText("0");
		imButton01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton01.isSelected()) {
					imButton01.setSelected(false);
					ball_wanwei_dintInt.remove(0);

				} else {
					imButton01.setSelected(true);
					ball_wanwei_dintInt.addInt(0);

				}
				getMoneyInfo();
			}
		});

		imButton02 = (Button) findViewById(R.id.buy_11x5_imageButton02);
		imButton02.setSelected(false);
		imButton02.setText("1");
		imButton02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton02.isSelected()) {
					imButton02.setSelected(false);
					ball_wanwei_dintInt.remove(1);

				} else {
					imButton02.setSelected(true);
					ball_wanwei_dintInt.addInt(1);

				}
				getMoneyInfo();
			}
		});

		imButton03 = (Button) findViewById(R.id.buy_11x5_imageButton03);
		imButton03.setSelected(false);
		imButton03.setText("2");
		imButton03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton03.isSelected()) {
					imButton03.setSelected(false);
					ball_wanwei_dintInt.remove(2);

				} else {
					imButton03.setSelected(true);
					ball_wanwei_dintInt.addInt(2);

				}
				getMoneyInfo();
			}
		});

		imButton04 = (Button) findViewById(R.id.buy_11x5_imageButton04);
		imButton04.setSelected(false);
		imButton04.setText("3");
		imButton04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton04.isSelected()) {
					imButton04.setSelected(false);
					ball_wanwei_dintInt.remove(3);

				} else {
					imButton04.setSelected(true);
					ball_wanwei_dintInt.addInt(3);

				}
				getMoneyInfo();
			}
		});
		imButton05 = (Button) findViewById(R.id.buy_11x5_imageButton05);
		imButton05.setSelected(false);
		imButton05.setText("4");
		imButton05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton05.isSelected()) {
					imButton05.setSelected(false);
					ball_wanwei_dintInt.remove(4);

				} else {
					imButton05.setSelected(true);
					ball_wanwei_dintInt.addInt(4);

				}
				getMoneyInfo();
			}
		});

		imButton06 = (Button) findViewById(R.id.buy_11x5_imageButton06);
		imButton06.setSelected(false);
		imButton06.setText("5");
		imButton06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton06.isSelected()) {
					imButton06.setSelected(false);
					ball_wanwei_dintInt.remove(5);

				} else {
					imButton06.setSelected(true);
					ball_wanwei_dintInt.addInt(5);

				}
				getMoneyInfo();
			}
		});

		imButton07 = (Button) findViewById(R.id.buy_11x5_imageButton07);
		imButton07.setSelected(false);
		imButton07.setText("6");
		imButton07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton07.isSelected()) {
					imButton07.setSelected(false);
					ball_wanwei_dintInt.remove(6);

				} else {
					imButton07.setSelected(true);
					ball_wanwei_dintInt.addInt(6);

				}
				getMoneyInfo();
			}
		});

		imButton08 = (Button) findViewById(R.id.buy_11x5_imageButton08);
		imButton08.setSelected(false);
		imButton08.setText("7");
		imButton08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton08.isSelected()) {
					imButton08.setSelected(false);
					ball_wanwei_dintInt.remove(7);

				} else {
					imButton08.setSelected(true);
					ball_wanwei_dintInt.addInt(7);

				}
				getMoneyInfo();
			}
		});

		imButton09 = (Button) findViewById(R.id.buy_11x5_imageButton09);
		imButton09.setSelected(false);
		imButton09.setText("8");
		imButton09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton09.isSelected()) {
					imButton09.setSelected(false);
					ball_wanwei_dintInt.remove(8);

				} else {
					imButton09.setSelected(true);
					ball_wanwei_dintInt.addInt(8);

				}
				getMoneyInfo();
			}
		});

		imButton10 = (Button) findViewById(R.id.buy_11x5_imageButton10);
		imButton10.setSelected(false);
		imButton10.setText("9");
		imButton10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButton10.isSelected()) {
					imButton10.setSelected(false);
					ball_wanwei_dintInt.remove(9);

				} else {
					imButton10.setSelected(true);
					ball_wanwei_dintInt.addInt(9);

				}
				getMoneyInfo();
			}
		});

	}

	public void init2ndBall() {
		ball_qianwei_dintInt = new DynArrayInt();

		imButtonb_01 = (Button) findViewById(R.id.buy_11x5_b_01);
		imButtonb_01.setSelected(false);
		imButtonb_01.setText("0");
		imButtonb_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_01.isSelected()) {
					imButtonb_01.setSelected(false);
					ball_qianwei_dintInt.remove(0);

				} else {
					imButtonb_01.setSelected(true);
					ball_qianwei_dintInt.addInt(0);

				}
				getMoneyInfo();
			}
		});

		imButtonb_02 = (Button) findViewById(R.id.buy_11x5_b_02);
		imButtonb_02.setSelected(false);
		imButtonb_02.setText("1");
		imButtonb_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_02.isSelected()) {
					imButtonb_02.setSelected(false);
					ball_qianwei_dintInt.remove(1);

				} else {
					imButtonb_02.setSelected(true);
					ball_qianwei_dintInt.addInt(1);

				}
				getMoneyInfo();
			}
		});

		imButtonb_03 = (Button) findViewById(R.id.buy_11x5_b_03);
		imButtonb_03.setSelected(false);
		imButtonb_03.setText("2");
		imButtonb_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_03.isSelected()) {
					imButtonb_03.setSelected(false);
					ball_qianwei_dintInt.remove(2);

				} else {
					imButtonb_03.setSelected(true);
					ball_qianwei_dintInt.addInt(2);

				}
				getMoneyInfo();
			}
		});

		imButtonb_04 = (Button) findViewById(R.id.buy_11x5_b_04);
		imButtonb_04.setSelected(false);
		imButtonb_04.setText("3");
		imButtonb_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_04.isSelected()) {
					imButtonb_04.setSelected(false);
					ball_qianwei_dintInt.remove(3);

				} else {
					imButtonb_04.setSelected(true);
					ball_qianwei_dintInt.addInt(3);

				}
				getMoneyInfo();
			}
		});

		imButtonb_05 = (Button) findViewById(R.id.buy_11x5_b_05);
		imButtonb_05.setSelected(false);
		imButtonb_05.setText("4");
		imButtonb_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_05.isSelected()) {
					imButtonb_05.setSelected(false);
					ball_qianwei_dintInt.remove(4);

				} else {
					imButtonb_05.setSelected(true);
					ball_qianwei_dintInt.addInt(4);

				}
				getMoneyInfo();
			}
		});

		imButtonb_06 = (Button) findViewById(R.id.buy_11x5_b_06);
		imButtonb_06.setSelected(false);
		imButtonb_06.setText("5");
		imButtonb_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_06.isSelected()) {
					imButtonb_06.setSelected(false);
					ball_qianwei_dintInt.remove(5);

				} else {
					imButtonb_06.setSelected(true);
					ball_qianwei_dintInt.addInt(5);

				}
				getMoneyInfo();
			}
		});

		imButtonb_07 = (Button) findViewById(R.id.buy_11x5_b_07);
		imButtonb_07.setSelected(false);
		imButtonb_07.setText("6");
		imButtonb_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_07.isSelected()) {
					imButtonb_07.setSelected(false);
					ball_qianwei_dintInt.remove(6);

				} else {
					imButtonb_07.setSelected(true);
					ball_qianwei_dintInt.addInt(6);

				}
				getMoneyInfo();
			}
		});

		imButtonb_08 = (Button) findViewById(R.id.buy_11x5_b_08);
		imButtonb_08.setSelected(false);
		imButtonb_08.setText("7");
		imButtonb_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_08.isSelected()) {
					imButtonb_08.setSelected(false);
					ball_qianwei_dintInt.remove(7);

				} else {
					imButtonb_08.setSelected(true);
					ball_qianwei_dintInt.addInt(7);

				}
				getMoneyInfo();
			}
		});

		imButtonb_09 = (Button) findViewById(R.id.buy_11x5_b_09);
		imButtonb_09.setSelected(false);
		imButtonb_09.setText("8");
		imButtonb_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_09.isSelected()) {
					imButtonb_09.setSelected(false);
					ball_qianwei_dintInt.remove(8);

				} else {
					imButtonb_09.setSelected(true);
					ball_qianwei_dintInt.addInt(8);

				}
				getMoneyInfo();
			}
		});

		imButtonb_10 = (Button) findViewById(R.id.buy_11x5_b_10);
		imButtonb_10.setSelected(false);
		imButtonb_10.setText("9");
		imButtonb_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonb_10.isSelected()) {
					imButtonb_10.setSelected(false);
					ball_qianwei_dintInt.remove(9);

				} else {
					imButtonb_10.setSelected(true);
					ball_qianwei_dintInt.addInt(9);

				}
				getMoneyInfo();
			}
		});

	}

	public void init3rdBall() {
		ball_baiwei_dintInt = new DynArrayInt();

		imButtonc_01 = (Button) findViewById(R.id.buy_11x5_c_01);
		imButtonc_01.setSelected(false);
		imButtonc_01.setText("0");
		imButtonc_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_01.isSelected()) {
					imButtonc_01.setSelected(false);
					ball_baiwei_dintInt.remove(0);

				} else {
					imButtonc_01.setSelected(true);
					ball_baiwei_dintInt.addInt(0);

				}
				getMoneyInfo();
			}
		});

		imButtonc_02 = (Button) findViewById(R.id.buy_11x5_c_02);
		imButtonc_02.setSelected(false);
		imButtonc_02.setText("1");
		imButtonc_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_02.isSelected()) {
					imButtonc_02.setSelected(false);
					ball_baiwei_dintInt.remove(1);

				} else {
					imButtonc_02.setSelected(true);
					ball_baiwei_dintInt.addInt(1);

				}
				getMoneyInfo();
			}
		});

		imButtonc_03 = (Button) findViewById(R.id.buy_11x5_c_03);
		imButtonc_03.setSelected(false);
		imButtonc_03.setText("2");
		imButtonc_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_03.isSelected()) {
					imButtonc_03.setSelected(false);
					ball_baiwei_dintInt.remove(2);

				} else {
					imButtonc_03.setSelected(true);
					ball_baiwei_dintInt.addInt(2);

				}
				getMoneyInfo();
			}
		});

		imButtonc_04 = (Button) findViewById(R.id.buy_11x5_c_04);
		imButtonc_04.setSelected(false);
		imButtonc_04.setText("3");
		imButtonc_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_04.isSelected()) {
					imButtonc_04.setSelected(false);
					ball_baiwei_dintInt.remove(3);

				} else {
					imButtonc_04.setSelected(true);
					ball_baiwei_dintInt.addInt(3);

				}
				getMoneyInfo();
			}
		});

		imButtonc_05 = (Button) findViewById(R.id.buy_11x5_c_05);
		imButtonc_05.setSelected(false);
		imButtonc_05.setText("4");
		imButtonc_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_05.isSelected()) {
					imButtonc_05.setSelected(false);
					ball_baiwei_dintInt.remove(4);

				} else {
					imButtonc_05.setSelected(true);
					ball_baiwei_dintInt.addInt(4);

				}
				getMoneyInfo();
			}
		});

		imButtonc_06 = (Button) findViewById(R.id.buy_11x5_c_06);
		imButtonc_06.setSelected(false);
		imButtonc_06.setText("5");
		imButtonc_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_06.isSelected()) {
					imButtonc_06.setSelected(false);
					ball_baiwei_dintInt.remove(5);

				} else {
					imButtonc_06.setSelected(true);
					ball_baiwei_dintInt.addInt(5);

				}
				getMoneyInfo();
			}
		});
		imButtonc_07 = (Button) findViewById(R.id.buy_11x5_c_07);
		imButtonc_07.setSelected(false);
		imButtonc_07.setText("6");
		imButtonc_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_07.isSelected()) {
					imButtonc_07.setSelected(false);
					ball_baiwei_dintInt.remove(6);

				} else {
					imButtonc_07.setSelected(true);
					ball_baiwei_dintInt.addInt(6);

				}
				getMoneyInfo();
			}
		});

		imButtonc_08 = (Button) findViewById(R.id.buy_11x5_c_08);
		imButtonc_08.setSelected(false);
		imButtonc_08.setText("7");
		imButtonc_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_08.isSelected()) {
					imButtonc_08.setSelected(false);
					ball_baiwei_dintInt.remove(7);

				} else {
					imButtonc_08.setSelected(true);
					ball_baiwei_dintInt.addInt(7);

				}
				getMoneyInfo();
			}
		});

		imButtonc_09 = (Button) findViewById(R.id.buy_11x5_c_09);
		imButtonc_09.setSelected(false);
		imButtonc_09.setText("8");
		imButtonc_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_09.isSelected()) {
					imButtonc_09.setSelected(false);
					ball_baiwei_dintInt.remove(8);

				} else {
					imButtonc_09.setSelected(true);
					ball_baiwei_dintInt.addInt(8);

				}
				getMoneyInfo();
			}
		});

		imButtonc_10 = (Button) findViewById(R.id.buy_11x5_c_10);
		imButtonc_10.setSelected(false);
		imButtonc_10.setText("9");
		imButtonc_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtonc_10.isSelected()) {
					imButtonc_10.setSelected(false);
					ball_baiwei_dintInt.remove(9);

				} else {
					imButtonc_10.setSelected(true);
					ball_baiwei_dintInt.addInt(9);

				}
				getMoneyInfo();
			}
		});

	}

	public void init4thBall() {
		ball_shiwei_dintInt = new DynArrayInt();

		imButtond_01 = (Button) findViewById(R.id.buy_11x5_d_01);
		imButtond_01.setSelected(false);
		imButtond_01.setText("0");
		imButtond_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_01.isSelected()) {
					imButtond_01.setSelected(false);
					ball_shiwei_dintInt.remove(0);

				} else {
					imButtond_01.setSelected(true);
					ball_shiwei_dintInt.addInt(0);

				}
				getMoneyInfo();
			}
		});

		imButtond_02 = (Button) findViewById(R.id.buy_11x5_d_02);
		imButtond_02.setSelected(false);
		imButtond_02.setText("1");
		imButtond_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_02.isSelected()) {
					imButtond_02.setSelected(false);
					ball_shiwei_dintInt.remove(1);

				} else {
					imButtond_02.setSelected(true);
					ball_shiwei_dintInt.addInt(1);

				}
				getMoneyInfo();
			}
		});

		imButtond_03 = (Button) findViewById(R.id.buy_11x5_d_03);
		imButtond_03.setSelected(false);
		imButtond_03.setText("2");
		imButtond_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_03.isSelected()) {
					imButtond_03.setSelected(false);
					ball_shiwei_dintInt.remove(2);

				} else {
					imButtond_03.setSelected(true);
					ball_shiwei_dintInt.addInt(2);

				}
				getMoneyInfo();
			}
		});

		imButtond_04 = (Button) findViewById(R.id.buy_11x5_d_04);
		imButtond_04.setSelected(false);
		imButtond_04.setText("3");
		imButtond_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_04.isSelected()) {
					imButtond_04.setSelected(false);
					ball_shiwei_dintInt.remove(3);

				} else {
					imButtond_04.setSelected(true);
					ball_shiwei_dintInt.addInt(3);

				}
				getMoneyInfo();
			}
		});

		imButtond_05 = (Button) findViewById(R.id.buy_11x5_d_05);
		imButtond_05.setSelected(false);
		imButtond_05.setText("4");
		imButtond_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_05.isSelected()) {
					imButtond_05.setSelected(false);
					ball_shiwei_dintInt.remove(4);

				} else {
					imButtond_05.setSelected(true);
					ball_shiwei_dintInt.addInt(4);

				}
				getMoneyInfo();
			}
		});

		imButtond_06 = (Button) findViewById(R.id.buy_11x5_d_06);
		imButtond_06.setSelected(false);
		imButtond_06.setText("5");
		imButtond_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_06.isSelected()) {
					imButtond_06.setSelected(false);
					ball_shiwei_dintInt.remove(5);

				} else {
					imButtond_06.setSelected(true);
					ball_shiwei_dintInt.addInt(5);

				}
				getMoneyInfo();
			}
		});
		imButtond_07 = (Button) findViewById(R.id.buy_11x5_d_07);
		imButtond_07.setSelected(false);
		imButtond_07.setText("6");
		imButtond_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_07.isSelected()) {
					imButtond_07.setSelected(false);
					ball_shiwei_dintInt.remove(6);

				} else {
					imButtond_07.setSelected(true);
					ball_shiwei_dintInt.addInt(6);

				}
				getMoneyInfo();
			}
		});

		imButtond_08 = (Button) findViewById(R.id.buy_11x5_d_08);
		imButtond_08.setSelected(false);
		imButtond_08.setText("7");
		imButtond_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_08.isSelected()) {
					imButtond_08.setSelected(false);
					ball_shiwei_dintInt.remove(7);

				} else {
					imButtond_08.setSelected(true);
					ball_shiwei_dintInt.addInt(7);

				}
				getMoneyInfo();
			}
		});

		imButtond_09 = (Button) findViewById(R.id.buy_11x5_d_09);
		imButtond_09.setSelected(false);
		imButtond_09.setText("8");
		imButtond_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_09.isSelected()) {
					imButtond_09.setSelected(false);
					ball_shiwei_dintInt.remove(8);

				} else {
					imButtond_09.setSelected(true);
					ball_shiwei_dintInt.addInt(8);

				}
				getMoneyInfo();
			}
		});

		imButtond_10 = (Button) findViewById(R.id.buy_11x5_d_10);
		imButtond_10.setSelected(false);
		imButtond_10.setText("9");
		imButtond_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtond_10.isSelected()) {
					imButtond_10.setSelected(false);
					ball_shiwei_dintInt.remove(9);

				} else {
					imButtond_10.setSelected(true);
					ball_shiwei_dintInt.addInt(9);

				}
				getMoneyInfo();
			}
		});

	}

	public void init5thBall() {
		ball_gewei_dintInt = new DynArrayInt();
		// e 个位
		imButtone_01 = (Button) findViewById(R.id.buy_11x5_e_01);
		imButtone_01.setSelected(false);
		imButtone_01.setText("0");
		imButtone_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_01.isSelected()) {
					imButtone_01.setSelected(false);
					ball_gewei_dintInt.remove(0);

				} else {
					imButtone_01.setSelected(true);
					ball_gewei_dintInt.addInt(0);

				}
				getMoneyInfo();
			}
		});

		imButtone_02 = (Button) findViewById(R.id.buy_11x5_e_02);
		imButtone_02.setSelected(false);
		imButtone_02.setText("1");
		imButtone_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_02.isSelected()) {
					imButtone_02.setSelected(false);
					ball_gewei_dintInt.remove(1);

				} else {
					imButtone_02.setSelected(true);
					ball_gewei_dintInt.addInt(1);

				}
				getMoneyInfo();
			}
		});

		imButtone_03 = (Button) findViewById(R.id.buy_11x5_e_03);
		imButtone_03.setSelected(false);
		imButtone_03.setText("2");
		imButtone_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_03.isSelected()) {
					imButtone_03.setSelected(false);
					ball_gewei_dintInt.remove(2);

				} else {
					imButtone_03.setSelected(true);
					ball_gewei_dintInt.addInt(2);

				}
				getMoneyInfo();
			}
		});

		imButtone_04 = (Button) findViewById(R.id.buy_11x5_e_04);
		imButtone_04.setSelected(false);
		imButtone_04.setText("3");
		imButtone_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_04.isSelected()) {
					imButtone_04.setSelected(false);
					ball_gewei_dintInt.remove(3);

				} else {
					imButtone_04.setSelected(true);
					ball_gewei_dintInt.addInt(3);

				}
				getMoneyInfo();
			}
		});

		imButtone_05 = (Button) findViewById(R.id.buy_11x5_e_05);
		imButtone_05.setSelected(false);
		imButtone_05.setText("4");
		imButtone_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_05.isSelected()) {
					imButtone_05.setSelected(false);
					ball_gewei_dintInt.remove(4);

				} else {
					imButtone_05.setSelected(true);
					ball_gewei_dintInt.addInt(4);

				}
				getMoneyInfo();
			}
		});

		imButtone_06 = (Button) findViewById(R.id.buy_11x5_e_06);
		imButtone_06.setSelected(false);
		imButtone_06.setText("5");
		imButtone_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_06.isSelected()) {
					imButtone_06.setSelected(false);
					ball_gewei_dintInt.remove(5);

				} else {
					imButtone_06.setSelected(true);
					ball_gewei_dintInt.addInt(5);

				}
				getMoneyInfo();
			}
		});
		imButtone_07 = (Button) findViewById(R.id.buy_11x5_e_07);
		imButtone_07.setSelected(false);
		imButtone_07.setText("6");
		imButtone_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_07.isSelected()) {
					imButtone_07.setSelected(false);
					ball_gewei_dintInt.remove(6);

				} else {
					imButtone_07.setSelected(true);
					ball_gewei_dintInt.addInt(6);

				}
				getMoneyInfo();
			}
		});

		imButtone_08 = (Button) findViewById(R.id.buy_11x5_e_08);
		imButtone_08.setSelected(false);
		imButtone_08.setText("7");
		imButtone_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_08.isSelected()) {
					imButtone_08.setSelected(false);
					ball_gewei_dintInt.remove(7);

				} else {
					imButtone_08.setSelected(true);
					ball_gewei_dintInt.addInt(7);

				}
				getMoneyInfo();
			}
		});

		imButtone_09 = (Button) findViewById(R.id.buy_11x5_e_09);
		imButtone_09.setSelected(false);
		imButtone_09.setText("8");
		imButtone_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_09.isSelected()) {
					imButtone_09.setSelected(false);
					ball_gewei_dintInt.remove(8);

				} else {
					imButtone_09.setSelected(true);
					ball_gewei_dintInt.addInt(8);

				}
				getMoneyInfo();
			}
		});

		imButtone_10 = (Button) findViewById(R.id.buy_11x5_e_10);
		imButtone_10.setSelected(false);
		imButtone_10.setText("9");
		imButtone_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (imButtone_10.isSelected()) {
					imButtone_10.setSelected(false);
					ball_gewei_dintInt.remove(9);

				} else {
					imButtone_10.setSelected(true);
					ball_gewei_dintInt.addInt(9);

				}
				getMoneyInfo();
			}
		});

	}

	public void init1stSingleBall() {
		ball_wanwei_dintInt = new DynArrayInt();
		// 万位
		imButton01 = (Button) findViewById(R.id.buy_11x5_imageButton01);
		imButton01.setSelected(false);
		imButton01.setText("0");
		imButton01.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// 每位只能选择一个号码
				if (!imButton02.isSelected() && (!imButton03.isSelected()) && (!imButton04.isSelected())
						&& (!imButton05.isSelected()) && (!imButton06.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton01.isSelected()) {
						imButton01.setSelected(false);
						ball_wanwei_dintInt.remove(0);
					} else {
						imButton01.setSelected(true);
						ball_wanwei_dintInt.addInt(0);
					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton02 = (Button) findViewById(R.id.buy_11x5_imageButton02);
		imButton02.setSelected(false);
		imButton02.setText("1");
		imButton02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if (!imButton01.isSelected() && (!imButton03.isSelected()) && (!imButton04.isSelected())
						&& (!imButton05.isSelected()) && (!imButton06.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton02.isSelected()) {
						imButton02.setSelected(false);
						ball_wanwei_dintInt.remove(1);
					} else {
						imButton02.setSelected(true);
						ball_wanwei_dintInt.addInt(1);
					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton03 = (Button) findViewById(R.id.buy_11x5_imageButton03);
		imButton03.setSelected(false);
		imButton03.setText("2");
		imButton03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if (!imButton01.isSelected() && (!imButton02.isSelected()) && (!imButton04.isSelected())
						&& (!imButton05.isSelected()) && (!imButton06.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton03.isSelected()) {
						imButton03.setSelected(false);
						ball_wanwei_dintInt.remove(2);
					} else {
						imButton03.setSelected(true);
						ball_wanwei_dintInt.addInt(2);
					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton04 = (Button) findViewById(R.id.buy_11x5_imageButton04);
		imButton04.setSelected(false);
		imButton04.setText("3");
		imButton04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton05.isSelected()) && (!imButton06.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton04.isSelected()) {
						imButton04.setSelected(false);
						ball_wanwei_dintInt.remove(3);

					} else {
						imButton04.setSelected(true);
						ball_wanwei_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});
		imButton05 = (Button) findViewById(R.id.buy_11x5_imageButton05);
		imButton05.setSelected(false);
		imButton05.setText("4");
		imButton05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton06.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton05.isSelected()) {
						imButton05.setSelected(false);
						ball_wanwei_dintInt.remove(4);

					} else {
						imButton05.setSelected(true);
						ball_wanwei_dintInt.addInt(4);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton06 = (Button) findViewById(R.id.buy_11x5_imageButton06);
		imButton06.setSelected(false);
		imButton06.setText("5");
		imButton06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton05.isSelected()) && (!imButton07.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton06.isSelected()) {
						imButton06.setSelected(false);
						ball_wanwei_dintInt.remove(5);
					} else {
						imButton06.setSelected(true);
						ball_wanwei_dintInt.addInt(5);
					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton07 = (Button) findViewById(R.id.buy_11x5_imageButton07);
		imButton07.setSelected(false);
		imButton07.setText("6");
		imButton07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton05.isSelected()) && (!imButton06.isSelected())
						&& (!imButton08.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton07.isSelected()) {
						imButton07.setSelected(false);
						ball_wanwei_dintInt.remove(6);
					} else {
						imButton07.setSelected(true);
						ball_wanwei_dintInt.addInt(6);
					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton08 = (Button) findViewById(R.id.buy_11x5_imageButton08);
		imButton08.setSelected(false);
		imButton08.setText("7");
		imButton08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton05.isSelected()) && (!imButton06.isSelected())
						&& (!imButton07.isSelected()) && (!imButton09.isSelected()) && (!imButton10.isSelected())) {
					if (imButton08.isSelected()) {
						imButton08.setSelected(false);
						ball_wanwei_dintInt.remove(7);

					} else {
						imButton08.setSelected(true);
						ball_wanwei_dintInt.addInt(7);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton09 = (Button) findViewById(R.id.buy_11x5_imageButton09);
		imButton09.setSelected(false);
		imButton09.setText("8");
		imButton09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton05.isSelected()) && (!imButton06.isSelected())
						&& (!imButton07.isSelected()) && (!imButton08.isSelected()) && (!imButton10.isSelected())) {
					if (imButton09.isSelected()) {
						imButton09.setSelected(false);
						ball_wanwei_dintInt.remove(8);

					} else {
						imButton09.setSelected(true);
						ball_wanwei_dintInt.addInt(8);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButton10 = (Button) findViewById(R.id.buy_11x5_imageButton10);
		imButton10.setSelected(false);
		imButton10.setText("9");
		imButton10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButton01.isSelected()) && (!imButton02.isSelected()) && (!imButton03.isSelected())
						&& (!imButton04.isSelected()) && (!imButton05.isSelected()) && (!imButton06.isSelected())
						&& (!imButton07.isSelected()) && (!imButton08.isSelected()) && (!imButton09.isSelected())) {
					if (imButton10.isSelected()) {
						imButton10.setSelected(false);
						ball_wanwei_dintInt.remove(9);

					} else {
						imButton10.setSelected(true);
						ball_wanwei_dintInt.addInt(9);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

	}

	public void init2ndSingleBall() {
		ball_qianwei_dintInt = new DynArrayInt();

		imButtonb_01 = (Button) findViewById(R.id.buy_11x5_b_01);
		imButtonb_01.setSelected(false);
		imButtonb_01.setText("0");
		imButtonb_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected()) && (!imButtonb_04.isSelected())
						&& (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_01.isSelected()) {
						imButtonb_01.setSelected(false);
						ball_qianwei_dintInt.remove(0);

					} else {
						imButtonb_01.setSelected(true);
						ball_qianwei_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_02 = (Button) findViewById(R.id.buy_11x5_b_02);
		imButtonb_02.setSelected(false);
		imButtonb_02.setText("1");
		imButtonb_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_03.isSelected()) && (!imButtonb_04.isSelected())
						&& (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_02.isSelected()) {
						imButtonb_02.setSelected(false);
						ball_qianwei_dintInt.remove(1);

					} else {
						imButtonb_02.setSelected(true);
						ball_qianwei_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_03 = (Button) findViewById(R.id.buy_11x5_b_03);
		imButtonb_03.setSelected(false);
		imButtonb_03.setText("2");
		imButtonb_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_04.isSelected())
						&& (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_03.isSelected()) {
						imButtonb_03.setSelected(false);
						ball_qianwei_dintInt.remove(2);

					} else {
						imButtonb_03.setSelected(true);
						ball_qianwei_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_04 = (Button) findViewById(R.id.buy_11x5_b_04);
		imButtonb_04.setSelected(false);
		imButtonb_04.setText("3");
		imButtonb_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_04.isSelected()) {
						imButtonb_04.setSelected(false);
						ball_qianwei_dintInt.remove(3);

					} else {
						imButtonb_04.setSelected(true);
						ball_qianwei_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_05 = (Button) findViewById(R.id.buy_11x5_b_05);
		imButtonb_05.setSelected(false);
		imButtonb_05.setText("4");
		imButtonb_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_06.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_05.isSelected()) {
						imButtonb_05.setSelected(false);
						ball_qianwei_dintInt.remove(4);

					} else {
						imButtonb_05.setSelected(true);
						ball_qianwei_dintInt.addInt(4);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_06 = (Button) findViewById(R.id.buy_11x5_b_06);
		imButtonb_06.setSelected(false);
		imButtonb_06.setText("5");
		imButtonb_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_05.isSelected()) && (!imButtonb_07.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_06.isSelected()) {
						imButtonb_06.setSelected(false);
						ball_qianwei_dintInt.remove(5);

					} else {
						imButtonb_06.setSelected(true);
						ball_qianwei_dintInt.addInt(5);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_07 = (Button) findViewById(R.id.buy_11x5_b_07);
		imButtonb_07.setSelected(false);
		imButtonb_07.setText("6");
		imButtonb_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected())
						&& (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_07.isSelected()) {
						imButtonb_07.setSelected(false);
						ball_qianwei_dintInt.remove(6);

					} else {
						imButtonb_07.setSelected(true);
						ball_qianwei_dintInt.addInt(6);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_08 = (Button) findViewById(R.id.buy_11x5_b_08);
		imButtonb_08.setSelected(false);
		imButtonb_08.setText("7");
		imButtonb_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected())
						&& (!imButtonb_07.isSelected()) && (!imButtonb_09.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_08.isSelected()) {
						imButtonb_08.setSelected(false);
						ball_qianwei_dintInt.remove(7);

					} else {
						imButtonb_08.setSelected(true);
						ball_qianwei_dintInt.addInt(7);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_09 = (Button) findViewById(R.id.buy_11x5_b_09);
		imButtonb_09.setSelected(false);
		imButtonb_09.setText("8");
		imButtonb_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected())
						&& (!imButtonb_07.isSelected()) && (!imButtonb_08.isSelected()) && (!imButtonb_10.isSelected())) {
					if (imButtonb_09.isSelected()) {
						imButtonb_09.setSelected(false);
						ball_qianwei_dintInt.remove(8);

					} else {
						imButtonb_09.setSelected(true);
						ball_qianwei_dintInt.addInt(8);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonb_10 = (Button) findViewById(R.id.buy_11x5_b_10);
		imButtonb_10.setSelected(false);
		imButtonb_10.setText("9");
		imButtonb_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonb_01.isSelected()) && (!imButtonb_02.isSelected()) && (!imButtonb_03.isSelected())
						&& (!imButtonb_04.isSelected()) && (!imButtonb_05.isSelected()) && (!imButtonb_06.isSelected())
						&& (!imButtonb_07.isSelected()) && (!imButtonb_08.isSelected()) && (!imButtonb_09.isSelected())) {
					if (imButtonb_10.isSelected()) {
						imButtonb_10.setSelected(false);
						ball_qianwei_dintInt.remove(9);

					} else {
						imButtonb_10.setSelected(true);
						ball_qianwei_dintInt.addInt(9);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

	}

	public void init3rdSingleBall() {
		ball_baiwei_dintInt = new DynArrayInt();

		imButtonc_01 = (Button) findViewById(R.id.buy_11x5_c_01);
		imButtonc_01.setSelected(false);
		imButtonc_01.setText("0");
		imButtonc_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected()) && (!imButtonc_04.isSelected())
						&& (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_01.isSelected()) {
						imButtonc_01.setSelected(false);
						ball_baiwei_dintInt.remove(0);

					} else {
						imButtonc_01.setSelected(true);
						ball_baiwei_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_02 = (Button) findViewById(R.id.buy_11x5_c_02);
		imButtonc_02.setSelected(false);
		imButtonc_02.setText("1");
		imButtonc_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_03.isSelected()) && (!imButtonc_04.isSelected())
						&& (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_02.isSelected()) {
						imButtonc_02.setSelected(false);
						ball_baiwei_dintInt.remove(1);

					} else {
						imButtonc_02.setSelected(true);
						ball_baiwei_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_03 = (Button) findViewById(R.id.buy_11x5_c_03);
		imButtonc_03.setSelected(false);
		imButtonc_03.setText("2");
		imButtonc_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_04.isSelected())
						&& (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_03.isSelected()) {
						imButtonc_03.setSelected(false);
						ball_baiwei_dintInt.remove(2);

					} else {
						imButtonc_03.setSelected(true);
						ball_baiwei_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_04 = (Button) findViewById(R.id.buy_11x5_c_04);
		imButtonc_04.setSelected(false);
		imButtonc_04.setText("3");
		imButtonc_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_04.isSelected()) {
						imButtonc_04.setSelected(false);
						ball_baiwei_dintInt.remove(3);

					} else {
						imButtonc_04.setSelected(true);
						ball_baiwei_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_05 = (Button) findViewById(R.id.buy_11x5_c_05);
		imButtonc_05.setSelected(false);
		imButtonc_05.setText("4");
		imButtonc_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_06.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_05.isSelected()) {
						imButtonc_05.setSelected(false);
						ball_baiwei_dintInt.remove(4);

					} else {
						imButtonc_05.setSelected(true);
						ball_baiwei_dintInt.addInt(4);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_06 = (Button) findViewById(R.id.buy_11x5_c_06);
		imButtonc_06.setSelected(false);
		imButtonc_06.setText("5");
		imButtonc_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_05.isSelected()) && (!imButtonc_07.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_06.isSelected()) {
						imButtonc_06.setSelected(false);
						ball_baiwei_dintInt.remove(5);

					} else {
						imButtonc_06.setSelected(true);
						ball_baiwei_dintInt.addInt(5);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});
		imButtonc_07 = (Button) findViewById(R.id.buy_11x5_c_07);
		imButtonc_07.setSelected(false);
		imButtonc_07.setText("6");
		imButtonc_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected())
						&& (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_07.isSelected()) {
						imButtonc_07.setSelected(false);
						ball_baiwei_dintInt.remove(6);

					} else {
						imButtonc_07.setSelected(true);
						ball_baiwei_dintInt.addInt(6);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_08 = (Button) findViewById(R.id.buy_11x5_c_08);
		imButtonc_08.setSelected(false);
		imButtonc_08.setText("7");
		imButtonc_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected())
						&& (!imButtonc_07.isSelected()) && (!imButtonc_09.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_08.isSelected()) {
						imButtonc_08.setSelected(false);
						ball_baiwei_dintInt.remove(7);

					} else {
						imButtonc_08.setSelected(true);
						ball_baiwei_dintInt.addInt(7);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_09 = (Button) findViewById(R.id.buy_11x5_c_09);
		imButtonc_09.setSelected(false);
		imButtonc_09.setText("8");
		imButtonc_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected())
						&& (!imButtonc_07.isSelected()) && (!imButtonc_08.isSelected()) && (!imButtonc_10.isSelected())) {
					if (imButtonc_09.isSelected()) {
						imButtonc_09.setSelected(false);
						ball_baiwei_dintInt.remove(8);

					} else {
						imButtonc_09.setSelected(true);
						ball_baiwei_dintInt.addInt(8);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtonc_10 = (Button) findViewById(R.id.buy_11x5_c_10);
		imButtonc_10.setSelected(false);
		imButtonc_10.setText("9");
		imButtonc_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtonc_01.isSelected()) && (!imButtonc_02.isSelected()) && (!imButtonc_03.isSelected())
						&& (!imButtonc_04.isSelected()) && (!imButtonc_05.isSelected()) && (!imButtonc_06.isSelected())
						&& (!imButtonc_07.isSelected()) && (!imButtonc_08.isSelected()) && (!imButtonc_09.isSelected())) {
					if (imButtonc_10.isSelected()) {
						imButtonc_10.setSelected(false);
						ball_baiwei_dintInt.remove(9);

					} else {
						imButtonc_10.setSelected(true);
						ball_baiwei_dintInt.addInt(9);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

	}

	public void init4thSingleBall() {
		ball_shiwei_dintInt = new DynArrayInt();

		imButtond_01 = (Button) findViewById(R.id.buy_11x5_d_01);
		imButtond_01.setSelected(false);
		imButtond_01.setText("0");
		imButtond_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_02.isSelected()) && (!imButtond_03.isSelected()) && (!imButtond_04.isSelected())
						&& (!imButtond_05.isSelected()) && (!imButtond_06.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_01.isSelected()) {
						imButtond_01.setSelected(false);
						ball_shiwei_dintInt.remove(0);

					} else {
						imButtond_01.setSelected(true);
						ball_shiwei_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_02 = (Button) findViewById(R.id.buy_11x5_d_02);
		imButtond_02.setSelected(false);
		imButtond_02.setText("1");
		imButtond_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_03.isSelected()) && (!imButtond_04.isSelected())
						&& (!imButtond_05.isSelected()) && (!imButtond_06.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_02.isSelected()) {
						imButtond_02.setSelected(false);
						ball_shiwei_dintInt.remove(1);

					} else {
						imButtond_02.setSelected(true);
						ball_shiwei_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_03 = (Button) findViewById(R.id.buy_11x5_d_03);
		imButtond_03.setSelected(false);
		imButtond_03.setText("2");
		imButtond_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_04.isSelected())
						&& (!imButtond_05.isSelected()) && (!imButtond_06.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_03.isSelected()) {
						imButtond_03.setSelected(false);
						ball_shiwei_dintInt.remove(2);

					} else {
						imButtond_03.setSelected(true);
						ball_shiwei_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_04 = (Button) findViewById(R.id.buy_11x5_d_04);
		imButtond_04.setSelected(false);
		imButtond_04.setText("3");
		imButtond_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_05.isSelected()) && (!imButtond_06.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_04.isSelected()) {
						imButtond_04.setSelected(false);
						ball_shiwei_dintInt.remove(3);

					} else {
						imButtond_04.setSelected(true);
						ball_shiwei_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_05 = (Button) findViewById(R.id.buy_11x5_d_05);
		imButtond_05.setSelected(false);
		imButtond_05.setText("4");
		imButtond_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_06.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_05.isSelected()) {
						imButtond_05.setSelected(false);
						ball_shiwei_dintInt.remove(4);

					} else {
						imButtond_05.setSelected(true);
						ball_shiwei_dintInt.addInt(4);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_06 = (Button) findViewById(R.id.buy_11x5_d_06);
		imButtond_06.setSelected(false);
		imButtond_06.setText("5");
		imButtond_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_05.isSelected()) && (!imButtond_07.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_06.isSelected()) {
						imButtond_06.setSelected(false);
						ball_shiwei_dintInt.remove(5);

					} else {
						imButtond_06.setSelected(true);
						ball_shiwei_dintInt.addInt(5);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});
		imButtond_07 = (Button) findViewById(R.id.buy_11x5_d_07);
		imButtond_07.setSelected(false);
		imButtond_07.setText("6");
		imButtond_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_05.isSelected()) && (!imButtond_06.isSelected())
						&& (!imButtond_08.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_07.isSelected()) {
						imButtond_07.setSelected(false);
						ball_shiwei_dintInt.remove(6);

					} else {
						imButtond_07.setSelected(true);
						ball_shiwei_dintInt.addInt(6);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_08 = (Button) findViewById(R.id.buy_11x5_d_08);
		imButtond_08.setSelected(false);
		imButtond_08.setText("7");
		imButtond_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_05.isSelected()) && (!imButtond_06.isSelected())
						&& (!imButtond_07.isSelected()) && (!imButtond_09.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_08.isSelected()) {
						imButtond_08.setSelected(false);
						ball_shiwei_dintInt.remove(7);

					} else {
						imButtond_08.setSelected(true);
						ball_shiwei_dintInt.addInt(7);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_09 = (Button) findViewById(R.id.buy_11x5_d_09);
		imButtond_09.setSelected(false);
		imButtond_09.setText("8");
		imButtond_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_05.isSelected()) && (!imButtond_06.isSelected())
						&& (!imButtond_07.isSelected()) && (!imButtond_08.isSelected()) && (!imButtond_10.isSelected())) {
					if (imButtond_09.isSelected()) {
						imButtond_09.setSelected(false);
						ball_shiwei_dintInt.remove(8);

					} else {
						imButtond_09.setSelected(true);
						ball_shiwei_dintInt.addInt(8);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtond_10 = (Button) findViewById(R.id.buy_11x5_d_10);
		imButtond_10.setSelected(false);
		imButtond_10.setText("9");
		imButtond_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtond_01.isSelected()) && (!imButtond_02.isSelected()) && (!imButtond_03.isSelected())
						&& (!imButtond_04.isSelected()) && (!imButtond_05.isSelected()) && (!imButtond_06.isSelected())
						&& (!imButtond_07.isSelected()) && (!imButtond_08.isSelected()) && (!imButtond_09.isSelected())) {
					if (imButtond_10.isSelected()) {
						imButtond_10.setSelected(false);
						ball_shiwei_dintInt.remove(9);

					} else {
						imButtond_10.setSelected(true);
						ball_shiwei_dintInt.addInt(9);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

	}

	public void init5thSingleBall() {
		ball_gewei_dintInt = new DynArrayInt();
		// e 个位
		imButtone_01 = (Button) findViewById(R.id.buy_11x5_e_01);
		imButtone_01.setSelected(false);
		imButtone_01.setText("0");
		imButtone_01.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_02.isSelected()) && (!imButtone_03.isSelected()) && (!imButtone_04.isSelected())
						&& (!imButtone_05.isSelected()) && (!imButtone_06.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_01.isSelected()) {
						imButtone_01.setSelected(false);
						ball_gewei_dintInt.remove(0);

					} else {
						imButtone_01.setSelected(true);
						ball_gewei_dintInt.addInt(0);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_02 = (Button) findViewById(R.id.buy_11x5_e_02);
		imButtone_02.setSelected(false);
		imButtone_02.setText("1");
		imButtone_02.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_03.isSelected()) && (!imButtone_04.isSelected())
						&& (!imButtone_05.isSelected()) && (!imButtone_06.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_02.isSelected()) {
						imButtone_02.setSelected(false);
						ball_gewei_dintInt.remove(1);

					} else {
						imButtone_02.setSelected(true);
						ball_gewei_dintInt.addInt(1);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_03 = (Button) findViewById(R.id.buy_11x5_e_03);
		imButtone_03.setSelected(false);
		imButtone_03.setText("2");
		imButtone_03.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_04.isSelected())
						&& (!imButtone_05.isSelected()) && (!imButtone_06.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_03.isSelected()) {
						imButtone_03.setSelected(false);
						ball_gewei_dintInt.remove(2);

					} else {
						imButtone_03.setSelected(true);
						ball_gewei_dintInt.addInt(2);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_04 = (Button) findViewById(R.id.buy_11x5_e_04);
		imButtone_04.setSelected(false);
		imButtone_04.setText("3");
		imButtone_04.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_05.isSelected()) && (!imButtone_06.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_04.isSelected()) {
						imButtone_04.setSelected(false);
						ball_gewei_dintInt.remove(3);

					} else {
						imButtone_04.setSelected(true);
						ball_gewei_dintInt.addInt(3);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_05 = (Button) findViewById(R.id.buy_11x5_e_05);
		imButtone_05.setSelected(false);
		imButtone_05.setText("4");
		imButtone_05.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_06.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_05.isSelected()) {
						imButtone_05.setSelected(false);
						ball_gewei_dintInt.remove(4);

					} else {
						imButtone_05.setSelected(true);
						ball_gewei_dintInt.addInt(4);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_06 = (Button) findViewById(R.id.buy_11x5_e_06);
		imButtone_06.setSelected(false);
		imButtone_06.setText("5");
		imButtone_06.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_05.isSelected()) && (!imButtone_07.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_06.isSelected()) {
						imButtone_06.setSelected(false);
						ball_gewei_dintInt.remove(5);

					} else {
						imButtone_06.setSelected(true);
						ball_gewei_dintInt.addInt(5);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});
		imButtone_07 = (Button) findViewById(R.id.buy_11x5_e_07);
		imButtone_07.setSelected(false);
		imButtone_07.setText("6");
		imButtone_07.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_05.isSelected()) && (!imButtone_06.isSelected())
						&& (!imButtone_08.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_07.isSelected()) {
						imButtone_07.setSelected(false);
						ball_gewei_dintInt.remove(6);

					} else {
						imButtone_07.setSelected(true);
						ball_gewei_dintInt.addInt(6);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_08 = (Button) findViewById(R.id.buy_11x5_e_08);
		imButtone_08.setSelected(false);
		imButtone_08.setText("7");
		imButtone_08.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_05.isSelected()) && (!imButtone_06.isSelected())
						&& (!imButtone_07.isSelected()) && (!imButtone_09.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_08.isSelected()) {
						imButtone_08.setSelected(false);
						ball_gewei_dintInt.remove(7);

					} else {
						imButtone_08.setSelected(true);
						ball_gewei_dintInt.addInt(7);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_09 = (Button) findViewById(R.id.buy_11x5_e_09);
		imButtone_09.setSelected(false);
		imButtone_09.setText("8");
		imButtone_09.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_05.isSelected()) && (!imButtone_06.isSelected())
						&& (!imButtone_07.isSelected()) && (!imButtone_08.isSelected()) && (!imButtone_10.isSelected())) {
					if (imButtone_09.isSelected()) {
						imButtone_09.setSelected(false);
						ball_gewei_dintInt.remove(8);

					} else {
						imButtone_09.setSelected(true);
						ball_gewei_dintInt.addInt(8);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

		imButtone_10 = (Button) findViewById(R.id.buy_11x5_e_10);
		imButtone_10.setSelected(false);
		imButtone_10.setText("9");
		imButtone_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// 每位只能选择一个号码
				if ((!imButtone_01.isSelected()) && (!imButtone_02.isSelected()) && (!imButtone_03.isSelected())
						&& (!imButtone_04.isSelected()) && (!imButtone_05.isSelected()) && (!imButtone_06.isSelected())
						&& (!imButtone_07.isSelected()) && (!imButtone_08.isSelected()) && (!imButtone_09.isSelected())) {
					if (imButtone_10.isSelected()) {
						imButtone_10.setSelected(false);
						ball_gewei_dintInt.remove(9);

					} else {
						imButtone_10.setSelected(true);
						ball_gewei_dintInt.addInt(9);

					}
				} else {
					Toast.makeText(CQSSCActivity.this, R.string.each_can_only_choose_a_number, Toast.LENGTH_SHORT)
							.show();
				}
				getMoneyInfo();
			}
		});

	}

	/**
	 * 初始化头部菜单玩法选择视图
	 */
	public void initSelectPlayTypeView() {
		// ApplicationData.getInstance().initList();
		TextView top_title_tvplaytype = (TextView) findViewById(R.id.top_title_tvplaytype);
		top_title_tvplaytype.setText(strPlayType);
		// setPlayTypeExplainText();
		initSPSelectView();
		initBall();
		allMoney = 0;
		count = 0;
		countText.setText(0 + "");
		moneyText.setText(0 + "");
		tvJiangJin.setText(context.getString(R.string.buy_show_jiangjin));
	}

	/**
	 * 菜单玩法按钮事件
	 * 
	 * @param btnId
	 */
	private void setBtnOnClick(final int btnId) {
		Button btn = (Button) menutypeview.findViewById(btnId);
		btn.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				menu_popupWindow.dismiss();
				setOrderField(btnId);

				if (ApplicationData.getInstance().getList_cqsscdto().size() == 0
						&& ApplicationData.getInstance().getAll_cqsscmoney() == 0
						&& ApplicationData.getInstance().getPlay_cqsscId() == 0) {
					initSelectPlayTypeView();
				} else {
					MyDialog.Builder dialog = new MyDialog.Builder(CQSSCActivity.this);
					dialog.setTitle("提示");
					dialog.setMessage("切换玩法将使之前所选号码清空，确认切换吗？");
					dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							ApplicationData.getInstance().initList();
							initSelectPlayTypeView();
							dialog.cancel();
						}
					});
					dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							dialog.cancel();
						}
					});
					dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
						@Override
						public void onCancel(DialogInterface dialog) {

							// int app_playId =
							// ApplicationData.getInstance().getPlay_cqsscId();
							String cqssctype = ApplicationData.getInstance().getPlay_cqssctype();
							// System.out.println("app_playId:" + app_playId +
							// "  playTypeId:" + playTypeId);
							if (cqssctype.equals("五星直选")) {
								playTypeId = 2803;
								strPlayType = "五星直选";
							} else if (cqssctype.equals("五星通选")) {
								playTypeId = 2806;
								strPlayType = "五星通选";
							} else if (cqssctype.equals("五星复选")) {
								playTypeId = 2802;
								strPlayType = "五星复选";
							} else if (cqssctype.equals("三星直选")) {
								playTypeId = 2803;
								strPlayType = "三星直选";
							} else if (cqssctype.equals("三星复选")) {
								playTypeId = 2802;
								strPlayType = "三星复选";
							} else if (cqssctype.equals("二星直选")) {
								playTypeId = 2803;
								strPlayType = "二星直选";
							} else if (cqssctype.equals("二星组选")) {
								playTypeId = 2808;
								strPlayType = "二星组选";
							} else if (cqssctype.equals("二星复选")) {
								playTypeId = 2802;
								strPlayType = "二星复选";
							} else if (cqssctype.equals("一星复式")) {
								playTypeId = 2803;
								strPlayType = "一星复式";
							} else if (cqssctype.equals("大小单双复式")) {
								playTypeId = 2804;
								strPlayType = "大小单双复式";
							}
							// initSelectPlayTypeView();
							dialog.cancel();
						}
					}).create().show();

				}
			}
		});
	}

	/**
	 * 获取玩法及改变按钮背景
	 * 
	 * @param btnId
	 */
	public void setOrderField(int btnId) {
		// 恢复默认
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button01)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button02)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button03)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button04)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button05)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button06)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button07)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button08)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button09)).setEnabled(true);
		((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button10)).setEnabled(true);
		// ((Button)
		// findViewById(R.id.hemai_main_btnJD)).setTextColor(context.getResources().getColor(R.color.black));
		switch (btnId) {
		case R.id.buy_newcqssc_topmenulink_Button01:
			playTypeId = 2803;
			strPlayType = "五星直选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button01)).setEnabled(false);
			// ((Button)
			// findViewById(R.id.hemai_main_btnJD)).setTextColor(context.getResources().getColor(R.color.white));
			break;
		case R.id.buy_newcqssc_topmenulink_Button02:
			playTypeId = 2806;
			strPlayType = "五星通选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button02)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button03:
			playTypeId = 2802;
			strPlayType = "五星复选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button03)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button04:
			playTypeId = 2803;
			strPlayType = "三星直选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button04)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button05:
			playTypeId = 2802;
			strPlayType = "三星复选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button05)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button06:
			playTypeId = 2803;
			strPlayType = "二星直选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button06)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button07:
			playTypeId = 2808;
			strPlayType = "二星组选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button07)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button08:
			playTypeId = 2802;
			strPlayType = "二星复选";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button08)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button09:
			playTypeId = 2803;
			strPlayType = "一星复式";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button09)).setEnabled(false);
			break;
		case R.id.buy_newcqssc_topmenulink_Button10:
			playTypeId = 2804;
			strPlayType = "大小单双复式";
			((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button10)).setEnabled(false);
			break;
		}
	}

	// TitleBar标题栏
	public void TitleBar() {
		// Title信息(返回+Title)
		Button back = (Button) findViewById(R.id.top_title_back);
		back.getBackground().setAlpha(255);// 透明度0~255透明度值 ，值越小越透明
		back.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				onKeyDown(KeyEvent.KEYCODE_BACK, null);
			}
		});

		TextView info = (TextView) findViewById(R.id.top_title_info);
		info.setText(R.string.buy_newcqssc);

		// final RelativeLayout top_title_rlplaytype = (RelativeLayout)
		// findViewById(R.id.top_title_rlplaytype);
		final LinearLayout buy_jclq_center_rl2 = (LinearLayout) findViewById(R.id.buy_jclq_center_rl2);
		buy_jclq_center_rl2.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				LayoutInflater inflater = LayoutInflater.from(CQSSCActivity.this);
				menutypeview = inflater.inflate(R.layout.buy_newcqssc_topmenulink, null);
				menu_popupWindow = new PopupWindow(menutypeview, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
				menu_popupWindow.setBackgroundDrawable(new BitmapDrawable());
				
				menu_popupWindow.setFocusable(true);
				menu_popupWindow.setTouchable(true);
				menu_popupWindow.setOutsideTouchable(false);
				
				menu_popupWindow.showAtLocation(menutypeview, Gravity.CENTER | Gravity.TOP, 0, 0);
				menu_popupWindow.showAsDropDown(buy_jclq_center_rl2);
				menutypeview.setOnClickListener(new View.OnClickListener() {
					public void onClick(View v) {
						// TODO Auto-generated method stub
						menu_popupWindow.dismiss();
					}
				});
				// 进度战绩总额按钮事件
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button01);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button02);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button03);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button04);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button05);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button06);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button07);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button08);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button09);
				setBtnOnClick(R.id.buy_newcqssc_topmenulink_Button10);
				// Log.d("elv", "点击menu_popupWindow");
				// select first button
				if (strPlayType.equals("五星直选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button01)).setEnabled(false);
				} else if (strPlayType.equals("五星通选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button02)).setEnabled(false);
				} else if (strPlayType.equals("五星复选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button03)).setEnabled(false);
				} else if (strPlayType.equals("三星直选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button04)).setEnabled(false);
				} else if (strPlayType.equals("三星复选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button05)).setEnabled(false);
				} else if (strPlayType.equals("二星直选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button06)).setEnabled(false);
				} else if (strPlayType.equals("二星组选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button07)).setEnabled(false);
				} else if (strPlayType.equals("二星复选")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button08)).setEnabled(false);
				} else if (strPlayType.equals("一星复式")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button09)).setEnabled(false);
				} else if (strPlayType.equals("大小单双复式")) {
					((Button) menutypeview.findViewById(R.id.buy_newcqssc_topmenulink_Button10)).setEnabled(false);
				}
			}
		});

		final Button refres = (Button) findViewById(R.id.top_title_refres);
		refres.setBackgroundDrawable(null);
		refres.setText("帮助");
		// refres.setBackgroundResource(R.color.common_menu);
		refres.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				LayoutInflater inflater = LayoutInflater.from(CQSSCActivity.this);
				View menuview = inflater.inflate(R.layout.public_menulink, null);// public_menulink_new11x5
				m_popupWindow = new PopupWindow(menuview, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
				m_popupWindow.setBackgroundDrawable(new BitmapDrawable());
				m_popupWindow.setOutsideTouchable(true);
				m_popupWindow.showAtLocation(menuview, Gravity.RIGHT | Gravity.TOP, 0, 0);
				m_popupWindow.showAsDropDown(refres);

				menuview.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						m_popupWindow.dismiss();
					}
				});

				Button public_menulink_Button01 = (Button) menuview.findViewById(R.id.public_menulink_Button01);
				public_menulink_Button01.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						m_popupWindow.dismiss();
						Intent intent;
						if (checkUserLogin()) {
							Intent intent0 = new Intent();
							intent0.putExtra("lotID", LOT_ID_CQSSC);
							intent0.setClass(CQSSCActivity.this, BetRecordActivity.class);
							startActivity(intent0);
						} else {
							intent = new Intent(getApplicationContext(), LoginActivity.class);
							startActivityForResult(intent, REQ_CODE_ELV);
						}
					}
				});

				Button public_menulink_Button02 = (Button) menuview.findViewById(R.id.public_menulink_Button02);
				public_menulink_Button02.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						m_popupWindow.dismiss();
						Intent intent;
						if (checkUserLogin()) {
							intent = new Intent(getApplicationContext(), ZhRecordActivity.class);
							startActivity(intent);
						} else {
							intent = new Intent(getApplicationContext(), LoginActivity.class);
							startActivityForResult(intent, REQ_CODE_ELV);
						}
					}
				});
				Button public_menulink_Button03 = (Button) menuview.findViewById(R.id.public_menulink_Button03);
				public_menulink_Button03.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						m_popupWindow.dismiss();
						Intent intent;
						intent = new Intent(getApplicationContext(), KjinfoListByType.class);
						intent.putExtra("LottID", "28");
						intent.putExtra("LottName", getString(R.string.kjinfo_number_cqssc_info));
						startActivity(intent);
					}
				});
				Button public_menulink_Button04 = (Button) menuview.findViewById(R.id.public_menulink_Button04);
				public_menulink_Button04.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						m_popupWindow.dismiss();
						// Intent intent = new Intent(getApplicationContext(),
						// HelpActivity.class);
						// startActivity(intent);
						Intent intent = new Intent(getApplicationContext(), CaiPiaoHelp.class);
						intent.putExtra("cp_title", "重庆时时彩");
						intent.putExtra("cp_url", "cqssc.html");
						startActivity(intent);
					}
				});
			}
		});
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub
		// m_popupWindow.dismiss();
		// return super.onTouchEvent(event);
		if (m_popupWindow != null) {
			m_popupWindow.dismiss();
		}
		return super.onTouchEvent(event);
	}

	public boolean checkUserLogin() {
		// app_cqsscdto = (ApplicationBall) getApplication();
		if (!ApplicationData.getInstance().getLoginName().equals("")
				&& !ApplicationData.getInstance().getLoginPwd().equals("")
				|| !ApplicationData.getInstance().getUserID().equals("")) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			// app_cqsscdto = (ApplicationBall) getApplication();
			if (ifbacklist) {
				Intent intent = new Intent();
				intent.putExtra("list_elvdto", ApplicationData.getInstance().getList_cqsscdto());
				intent.putExtra("PlayTypeID", playTypeId);
				intent.putExtra("AllMoney", ApplicationData.getInstance().getAll_cqsscmoney());
				intent.putExtra("LotID", lotID);
				intent.putExtra("Count", count);
				intent.putExtra("IssueID", issueID);
				intent.putExtra("IssueName", issueName);
				intent.putExtra("strPlayType", strPlayType);
				prizeIntellChase = getIntent().getIntExtra("prizeIntellChase", 0);
				//Log.d("van",prizeIntellChase +"--------" );
				intent.putExtra("prizeIntellChase",prizeIntellChase);
				intent.setClass(CQSSCActivity.this, CQSSCListActivity.class);
				startActivityForResult(intent, REQ_CODE_BUYMAIN);// (intent);
			} else {
				if(ifPush){
					Intent intent = new Intent(this, JddMainActivity.class);
					startActivity(intent);
				}
				ApplicationData.getInstance().initList();
			}
			this.finish();
			return true;
		} else {
			return super.onKeyDown(keyCode, event);
		}

	};

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.app.Activity#onActivityResult(int, int,
	 * android.content.Intent)
	 */
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		if (requestCode == REQ_CODE_BUYMAIN && resultCode == RESULT_OK) {
			onKeyDown(KeyEvent.KEYCODE_BACK, null);
		} 
			
		if(resultCode == RESULT_OK) {
			if(requestCode == REQ_CODE_BUY_LOGIN ) {
			goXhlbSubmit();
		}
		}
	};

	private void goXhlbSubmit() {

		// TODO Auto-generated method stub
		if (checkUserLogin()) {
			Log.d("CQSSCActivity", "submit issueName= " + issueName);
			if (issueName == null || issueName.equals("")) {
				Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_2, Toast.LENGTH_SHORT).show();
				return;
			}
			if (!(allMoney == 0 || count == 0)) {
				BallDTO elvdto = new BallDTO();
				// 获得自定义的应用程序BallDTO
				// app_cqsscdto = (ApplicationBall) getApplication();
				if (strPlayType.equals("五星直选") || strPlayType.equals("五星通选") || strPlayType.equals("五星复选")) {
					// 获取每位的长度
					int a = ball_wanwei_dintInt.getSize();
					int b = ball_qianwei_dintInt.getSize();
					int c = ball_baiwei_dintInt.getSize();
					int d = ball_shiwei_dintInt.getSize();
					int e = ball_gewei_dintInt.getSize();
					String ball = "";
					if (a >= 1 && b >= 1 && c >= 1 && d >= 1 && e >= 1) {
						String wanwei_ball = ball_wanwei_dintInt.getAllIntToStringForSingle(ball_wanwei_dintInt
								.getAllInt());
						wanwei_ball = wanwei_ball.substring(0, wanwei_ball.length() - 1);
						String qianwei_ball = ball_qianwei_dintInt
								.getAllIntToStringForSingle(ball_qianwei_dintInt.getAllInt());
						qianwei_ball = qianwei_ball.substring(0, qianwei_ball.length() - 1);
						String baiwei_ball = ball_baiwei_dintInt.getAllIntToStringForSingle(ball_baiwei_dintInt
								.getAllInt());
						baiwei_ball = baiwei_ball.substring(0, baiwei_ball.length() - 1);
						String shiwei_ball = ball_shiwei_dintInt.getAllIntToStringForSingle(ball_shiwei_dintInt
								.getAllInt());
						shiwei_ball = shiwei_ball.substring(0, shiwei_ball.length() - 1);
						String gewei_ball = ball_gewei_dintInt.getAllIntToStringForSingle(ball_gewei_dintInt
								.getAllInt());
						gewei_ball = gewei_ball.substring(0, gewei_ball.length() - 1);
						wanwei_ball = DynArrayInt.sortBall(wanwei_ball);
						qianwei_ball = DynArrayInt.sortBall(qianwei_ball);
						baiwei_ball = DynArrayInt.sortBall(baiwei_ball);
						shiwei_ball = DynArrayInt.sortBall(shiwei_ball);
						gewei_ball = DynArrayInt.sortBall(gewei_ball);
						ball = wanwei_ball + "|" + qianwei_ball + "|" + baiwei_ball + "|" + shiwei_ball + "|"
								+ gewei_ball;
						Log.i("五星", "ball= " + ball);
						sendIntent(elvdto, ball);
					} else {
						Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_3, Toast.LENGTH_SHORT).show();
					}
				} else if (strPlayType.equals("三星直选") || strPlayType.equals("三星复选")) {
					// 获取每位的长度
					int a = ball_baiwei_dintInt.getSize();
					int b = ball_shiwei_dintInt.getSize();
					int c = ball_gewei_dintInt.getSize();
					String ball = "";
					if (a >= 1 && b >= 1 && c >= 1) {
						String first_ball = ball_baiwei_dintInt.getAllIntToStringForSingle(ball_baiwei_dintInt
								.getAllInt());
						first_ball = first_ball.substring(0, first_ball.length() - 1);
						String second_ball = ball_shiwei_dintInt.getAllIntToStringForSingle(ball_shiwei_dintInt
								.getAllInt());
						second_ball = second_ball.substring(0, second_ball.length() - 1);
						String third_ball = ball_gewei_dintInt.getAllIntToStringForSingle(ball_gewei_dintInt
								.getAllInt());
						third_ball = third_ball.substring(0, third_ball.length() - 1);
						first_ball = DynArrayInt.sortBall(first_ball);
						second_ball = DynArrayInt.sortBall(second_ball);
						third_ball = DynArrayInt.sortBall(third_ball);
						ball = first_ball + "|" + second_ball + "|" + third_ball;
						Log.i("三星", "ball= " + ball);
						sendIntent(elvdto, ball);
					} else {
						Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_4, Toast.LENGTH_SHORT).show();
					}
				} else if (strPlayType.equals("二星直选") || strPlayType.equals("二星复选")) {
					int a = ball_shiwei_dintInt.getSize();
					int b = ball_gewei_dintInt.getSize();
					String ball = "";
					if (a >= 1 && b >= 1) {
						String first_ball = ball_shiwei_dintInt.getAllIntToStringForSingle(ball_shiwei_dintInt
								.getAllInt());
						first_ball = first_ball.substring(0, first_ball.length() - 1);
						String second_ball = ball_gewei_dintInt.getAllIntToStringForSingle(ball_gewei_dintInt
								.getAllInt());
						second_ball = second_ball.substring(0, second_ball.length() - 1);
						first_ball = DynArrayInt.sortBall(first_ball);
						second_ball = DynArrayInt.sortBall(second_ball);
						ball = first_ball + "|" + second_ball;
						Log.i("二星", "ball= " + ball);
						sendIntent(elvdto, ball);
					} else {
						Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_5, Toast.LENGTH_SHORT).show();
					}
				} else if (strPlayType.equals("一星复式") || strPlayType.equals("二星组选")) {
					if (ball_gewei_dintInt.getSize() >= getRandomNum()) {
						// int[]数组中
						String ball = ball_gewei_dintInt.getAllIntToStringForSingle(ball_gewei_dintInt
								.getAllInt());
						ball = ball.substring(0, ball.length() - 1);
						ball = DynArrayInt.sortBall(ball);
						Log.i("一星", "ball= " + ball);
						sendIntent(elvdto, ball);
					} else {
						Toast.makeText(CQSSCActivity.this, "至少选择" + getRandomNum() + "号码!", Toast.LENGTH_SHORT)
								.show();
					}
				} else if (strPlayType.equals("大小单双复式")) {
					int a = ball_dxdsShi_dintInt.getSize();
					int b = ball_dxdsGe_dintInt.getSize();
					String ball = "";
					if (a >= 1 && b >= 1) {
						String first_ball = ball_dxdsShi_dintInt
								.getAllIntToStringForSingle(ball_dxdsShi_dintInt.getAllInt());
						first_ball = first_ball.substring(0, first_ball.length() - 1);
						String second_ball = ball_dxdsGe_dintInt.getAllIntToStringForSingle(ball_dxdsGe_dintInt
								.getAllInt());
						second_ball = second_ball.substring(0, second_ball.length() - 1);
						ball = first_ball + "|" + second_ball;
						Log.i("大小单双", "ball= " + ball);
						sendIntent(elvdto, ball);
					} else {
						Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_6, Toast.LENGTH_SHORT).show();
					}
				}
			} else {
				// if
				// (ApplicationData.getInstance().getList_cqsscdto().size()
				// == 0) {
				Toast.makeText(CQSSCActivity.this, R.string.cqsscactivity_7, Toast.LENGTH_SHORT).show();
				// } else {
				// setplayTypeId();
				// Intent intent = new Intent();
				// intent.putExtra("list_elvdto",
				// ApplicationData.getInstance().getList_cqsscdto());
				// intent.putExtra("PlayTypeID", playTypeId);
				// // intent.putExtra("PlayType",
				// // playType.getSelectedItem().toString());
				// intent.putExtra("AllMoney",
				// ApplicationData.getInstance().getAll_cqsscmoney());
				// intent.putExtra("LotID", lotID);
				// intent.putExtra("Count", count);
				// intent.putExtra("IssueID", issueID);
				// intent.putExtra("IssueName", issueName);
				// intent.putExtra("strPlayType", strPlayType);
				// intent.setClass(CQSSCActivity.this,
				// CQSSCListActivity.class);
				// startActivityForResult(intent, REQ_CODE_BUYMAIN);//
				// (intent);
				// }
			}
		} else {
			Intent intent = new Intent();
			intent.setClass(CQSSCActivity.this, LoginActivity.class);
			startActivityForResult(intent, REQ_CODE_BUY_LOGIN);
			// Log.v("", "登录");
		}
	
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
		SysApplication.getInstance().removeActivity(this);
	};

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		handler.removeCallbacks(runnable);
		super.onDestroy();
	}
}